How to use the @poppinss/utils.esmResolver function in @poppinss/utils

To help you get started, we’ve selected a few @poppinss/utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github edge-js / edge / src / Loader / index.ts View on Github external
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
      }
    }
  }

@poppinss/utils

Handy utilities for repetitive work

MIT
Latest version published 3 months ago

Package Health Score

78 / 100
Full package analysis