Error [ERR_UNKNOWN_FILE_EXTENSION] on latest version of MSW (v0.48.2)
See original GitHub issuePrerequisites
- I confirm my issue is not in the opened issues
- I confirm the Frequently Asked Questions didn’t contain the answer to my issue
Environment check
- I’m using the latest
msw
version - I’m using Node.js version 14 or higher
Node.js version
v16.14.2
Reproduction repository
vercel/next.js example: with-msw
Reproduction steps
- Install and start the with-msw example:
yarn create next-app --example with-msw with-msw-app
cd with-msw-app
yarn dev
- visit localhost:3000
Current behavior
There is an ESM related error in the terminal.
error - unhandledRejection: TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".json" for /home/s/temp/next.js/examples/with-msw/node_modules/statuses/codes.json
at new NodeError (node:internal/errors:371:5)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:87:11)
at defaultGetFormat (node:internal/modules/esm/get_format:102:38)
at defaultLoad (node:internal/modules/esm/load:21:14)
at ESMLoader.load (node:internal/modules/esm/loader:359:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:280:58)
at new ModuleJob (node:internal/modules/esm/module_job:66:26)
at ESMLoader.#createModuleJob (node:internal/modules/esm/loader:297:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:261:34)
at async ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:81:21) {
code: 'ERR_UNKNOWN_FILE_EXTENSION'
}
Expected behavior
No error in the terminal
Comment
I am not looking for a temporary fix such as, forcing next to NOT use ESM modules in packages.
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
No results found
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
https://github.com/mswjs/msw/pull/1458
Released: v0.48.3 🎉
This has been released in v0.48.3!
Make sure to always update to the latest version (
npm i msw@latest
) to get the newest features and bug fixes.Predictable release automation by @ossjs/release.