modernweb-dev / web

Guides, tools and libraries for modern web development.
https://modern-web.dev
MIT License
2.15k stars 271 forks source link

`TypeError: Failed to fetch dynamically imported module` only in Windows in GitHub Actions #2527

Open trusktr opened 8 months ago

trusktr commented 8 months ago

When I run tests locally in Windows, they work fine.

For some reason, import of some files is not working in Windows in CI (GitHub Actions):

https://github.com/lume/lume/actions/runs/6702225570/job/18211044889?pr=287

The output (in the test section) shows this:

dist\behaviors\DefaultBehaviors.test.js:

 🚧 Browser logs:
      TypeError: Failed to fetch dynamically imported module: http://localhost:3366/dist/behaviors/DefaultBehaviors.test.js?wtr-session-id=6Dp5Mh8y1PNtD5fvis4Cz&wds-import-map=0

 ❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information. 

dist\core\Element3D.test.js:

 🚧 Browser logs:
      TypeError: Failed to fetch dynamically imported module: http://localhost:3366/dist/core/Element3D.test.js?wtr-session-id=ec1wUB4LLodIFFBMIYLR2&wds-import-map=0&wds-import-map=0

 ❌ Could not import your test module. Check the browser logs or open the browser in debug mode for more information. 

The files for the commit of that build exist though:

The test-runner config is here:

The config is in the @lume/cli package, which is a git submodule in lume's main repo linked to the top-level node_modules with yarn workspaces.

I wonder what could possibly be causing this.

It's always Windows isn't it!

bashmish commented 8 months ago

If I understood your correctly, it works for you on Windows, only locally, but not in CI. From the error log I can't say why it happens, but just by the fact that it breaks in CI only makes me think that it's CI related issue rather than a WTR one.

I'd suggest to try to reproduce it locally, e.g. by using same config instead of switching it depending on the CI like in

    // Override the default Chrome launcher with Playwright launcher so to test
    // in all browsers in CI.
    browsers: process.env.CI
        ? [playwrightLauncher({product: 'chromium'})]
        : // undefined defaults to Chrome (must be locally installed)
          undefined,