unistore icon indicating copy to clipboard operation
unistore copied to clipboard

Errors with WMR

Open zgoda opened this issue 3 years ago • 2 comments

Build:

$ npm run build

> build
> wmr build --prerender

Error when using sourcemap for reporting an error: Can't resolve original location of error.

'Provider' is not exported by npm/[email protected]/preact.js, imported by public/index.js
    at si (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:88033)
    at Ia.error (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:171300)
    at Ia.traceVariable (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:179030)
    at Ho.findVariable (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:157247)
    at En.findVariable (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:43076)
    at Bn.findVariable (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:43076)
    at Kn.bind (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:63816)
    at Go.bind (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:44364)
    at Fo.bind (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:44378)
    at Fo.bind (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:155881)

In dev (excerpt):

Error bundling unistore/preact.js.map:  Error: Unexpected token (Note that you need plugins to import files that are not JavaScript)
    at si (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:88033)
    at Ia.error (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:171300)
    at Ia.tryParse (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:179404)
    at Ia.setSource (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:176750)
    at uu.addModuleSource (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:328734)
    at async uu.fetchModule (/home/jazg/work/micro/beercounter/node_modules/wmr/wmr.cjs:2:329907)
    at async Promise.all (index 0) {
  code: 'PARSE_ERROR',
  parserError: SyntaxError: Unexpected token (1:10)

It seems incompatible with WMR (or vice-versa).

zgoda avatar Apr 28 '21 20:04 zgoda

With recent WMR in dev:

Error bundling unistore/@npm/preact:  Error: Could not load npm/[email protected]/@npm/preact: File not found ENOENT: no such file or directory, open '/home/jazg/work/breadcalc2/node_modules/unistore/@npm/preact'
    at WR (/home/jazg/work/breadcalc2/node_modules/wmr/wmr.cjs:2:1240242)
    at async Ku.addModuleSource (/home/jazg/work/breadcalc2/node_modules/wmr/wmr.cjs:2:352834)
    at async Ku.fetchModule (/home/jazg/work/breadcalc2/node_modules/wmr/wmr.cjs:2:354542)
    at async Promise.all (index 0) {
  code: 'PLUGIN_ERROR',
  plugin: 'npm-plugin',
  hook: 'load',
  watchFiles: [ 'npm/[email protected]/@npm/preact' ]
}

500 /@npm/unistore/@npm/preact - Could not load npm/[email protected]/@npm/preact: File not found ENOENT: no such file or directory, open '/home/jazg/work/breadcalc2/node_modules/unistore/@npm/preact'

  at WR (/home/jazg/work/breadcalc2/node_modules/wmr/wmr.cjs:2:1240242)
  at async Ku.addModuleSource (/home/jazg/work/breadcalc2/node_modules/wmr/wmr.cjs:2:352834)
  at async Ku.fetchModule (/home/jazg/work/breadcalc2/node_modules/wmr/wmr.cjs:2:354542)
  at async Promise.all (:-1:-1)

zgoda avatar Oct 16 '21 14:10 zgoda

You should be able to import from unistore/full/preact.es.js without issue.

The top level preact.js is CJS, which is probably going to struggle.

rschristian avatar Nov 10 '21 08:11 rschristian