Description
I have now several times seen problems with npm packages that fails to import due to themselves or internally not handling default exports properly.
My latest problems with this is from the https://www.npmjs.com/package/expression-eval package (but it is easy find more projects with similar issues):
SyntaxError: The requested module './../../jsep/build/jsep.js' does not provide an export named 'default'
Some other issues probably related to this:
- Add ES modules to the bundle testing-library/user-event#547
- Unable to import intl-messageformat as standard ESM module formatjs/formatjs#2841
For the development server when I switched to vite instead of @web/dev-server
all these imports just worked out of the box.
For sure in the best of worlds all older npm packages would be updated to latest ESM standards, but in reality that will take a long time.
Would it be possible to add similar import fixes that vite applies to the @web/dev-server
and @web/test-runner
as well?
Apart from this both packages are superb, I have been using them through the npm init @open-wc
helper, but had to resort to vite for now, and possibly something else for testing now as well.
I also tried finding more details around the nodeResolve
property in my web-test-runner.config.mjs
and the possibility to setup some config there but I cannot find any config there much more useful than the simplest nodeResolve: true
setting.
How are the rest of you working around this current limitation?