Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _getPresenterForTemplate (templatePath: string): LoaderTemplate['Presenter'] | undefined {
const presenterPath = templatePath
.replace(/^\w/, c => c.toUpperCase())
.replace(extname(templatePath), '.presenter.js')
try {
return esmResolver(requireUncached(presenterPath)) as LoaderTemplate['Presenter']
} catch (error) {
if (['ENOENT', 'MODULE_NOT_FOUND'].indexOf(error.code) === -1) {
throw error
}
}
}