enhance-dev/enhance-element

Show exception when catching error when loading a component

Closed this issue · 1 comments

janl commented

I got Ignoring component files that do not include a render function and could for the life of me understand why.

Adding the actual error helped in https://github.com/enhance-dev/arc-plugin-enhance/blob/1dd314b86f15477e552cf932a1fb53be5caed71b/src/http/any-catchall/_get-elements.mjs#L95

      catch (error) {
        console.warn('Ignoring component files that do not include a render function', error)
      }

Ignoring component files that do not include a render function Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@enhance/custom-element' imported from /Users/jan/Work/nh/nh-track/app/components/list-item.mjs
    at new NodeError (node:internal/errors:393:5)
    at packageResolve (node:internal/modules/esm/resolve:860:9)
    at moduleResolve (node:internal/modules/esm/resolve:909:20)
    at defaultResolve (node:internal/modules/esm/resolve:1124:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
    at link (node:internal/modules/esm/module_job:75:36) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Looks like npm i @enhance/custom-element is needed to get this, but that’s not mentioned anywhere on https://enhance.dev/docs/conventions/components

@janl this should be fixed in 9.4.0 of @enhance/arc-plugin-enhance as it will no longer swallow the error.