Skip to content

[@web/test-runner] cannot import all npm packages #1439

Closed
@tirithen

Description

@tirithen

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions