-
-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error [ERR_UNSUPPORTED_DIR_IMPORT] on latest version of MSW (even when the project is not "type": "module") #1435
Comments
having the same issue here with the latest next.js & msw version |
Are there any alternatives to msw with next? Tried nock but it's not as nice |
i fixed that in my code... it's bug I hope they fix it go to msw>lib>node>index.mjs --fix --old--with--pug |
If you're looking for a quick/temporary fix for usage with next.js, you can force next to NOT use ESM modules in packages. /** @type {import("next").NextConfig} */
module.exports = {
experimental: {
esmExternals: false,
},
} See: vercel/next.js#40904 |
@AleskiWeb Can you tell me what version of msw is this and what version will still work? I tried specifically with 0.47.2 but still have that error |
@harm-meijer - Latest version still has these issues (albeit a different import it complains about now) The only work around was to use the experimental flag above |
#1453 This was merged recently, maybe |
Although there are still bits missing in support for ESM stuff, this particular issue has been fixed so I will close this, thanks all! |
Prerequisites
Environment check
msw
versionNode.js version
16.18
Reproduction repository
https://github.com/AleskiWeb/mswjs-next
Reproduction steps
I know there is a lot of discussion in issues here on the project relating directly to ESM support, however I don't think I am trying to use this as a module but still keep running up against the same error.
Happy to be told otherwise! I am just lost with the steps to get me out of this tailspin.
Furthermore, using https://github.com/vercel/next.js/tree/canary/examples/with-msw also has the same error in the console
The above repository was made using the simple setup instructions from the nextjs docs, followed by an implementation of the MSW docs (currently mocking nothing but the error still persists)
Current behavior
Expected behavior
index.js
in thelib/node/
folderThe text was updated successfully, but these errors were encountered: