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
Cannot find module msw/node after updating #1960
Comments
Hi, @joshbenhamou. I've just updated all the examples to the latest version of MSW and they all pass. Could you please confirm your issue is solved? |
Thanks @kettanaito . The sandbox link is no longer working for me in https://github.com/mswjs/examples/tree/main/examples/with-vitest. However, I saw that you updated the MSW package to 2.0.14 and tried that locally. Same problem with that version and also with 2.1.3 |
Oh, thanks for pointing out the broken sandboxes! Caused by renaming the repo and deleting the old one. Will fix. Edit: the sandbox is running properly now but it doesn't seem CodeSandbox allows us to use terminal anymore to run tests. You may want to check that example locally. |
Thanks. The sandbox is working for me now. It looks like the change you've made that is the |
I'm experiencing the same issue, but no changes to module/moduleResolution seem to resolve it in my project. I do notice that the sandbox is a major version behind on both vitest and resolved vite version.. that being said, after bumping these, I still cannot reproduce the issue in the sandbox 🙃 |
Same as @iChip , it's still not working for me but I haven't had the time to investigate yet unfortunately |
Same thing happens for me. My setup is Remix, Cloudflare Workers, Playwright with following configs: ...
"moduleResolution": "Bundler",
"module": "ES2022",
"resolveJsonModule": true,
"target": "ES2022",
... /** @type {import('@remix-run/dev').AppConfig} */
export default {
ignoredRouteFiles: [`**/.*`],
server: `./app/server.ts`,
serverConditions: ['workerd', 'worker', 'browser'],
serverDependenciesToBundle: [
// bundle everything except the virtual module for the static content manifest provided by wrangler
/^(?!.*\b__STATIC_CONTENT_MANIFEST\b).*$/,
],
serverMainFields: [`browser`, `module`, `main`],
serverMinify: true,
serverModuleFormat: `esm`,
serverPlatform: `neutral`,
browserNodeBuiltinsPolyfill: {
modules: {
buffer: true,
},
},
serverNodeBuiltinsPolyfill: {
modules: ['util', 'crypto'],
},
} Do we have any ideas what might be the cause? I am willing to give a stab and fixing it if there is a person who could point me to a direction! |
Just want to chime and and mention I am upgrading MSW from 1.3.3 to 2.2.13 and receive the same error Package path ./node is not exported from package /Users/damien/Documents/Git/Maia/monorepo/node_modules/msw (see exports field in /Users/damien/Documents/Git/Maia/monorepo/node_modules/msw/package.json) My scripts is very basic import { setupServer, type SetupServer } from 'msw/node';
import { handlers } from './handlers';
export const server: SetupServer = setupServer(...handlers); |
I'm also running into the same issue after upgrading. My use case is to mock out API responses for components using Storybook and the MSW addon. I tried upgrading everything together -- MSW to v2, msw-storybook-addon to v2, Storybook from v7 to v8 -- but no matter what I try I'm getting the same error as @DamienDeloubes. I tried the hacky solution mentioned in another issue but that still caused errors with any component's Storybook file that was using the MSW addon. I've tried adjusting my |
IDK if this will help you, but I had a similar issue and found that the hacky solution only worked if I removed the |
Thanks for the idea. Unfortunately, I'm still getting the |
With the help from @phryneas, we've done some improvements in the export conditions in MSW. Please upgrade to |
Prerequisites
Environment check
msw
versionNode.js version
21.4.0
Reproduction repository
https://github.com/mswjs/examples/tree/main/examples/with-vitest
Reproduction steps
The issue is happening in the official MSW Vitest example. Check out the sandbox link and see the typescript error https://codesandbox.io/p/sandbox/github/mswjs/examples-new/tree/main/examples/with-vitest?file=%2Fmocks%2Fnode.ts%3A2%2C32-3%2C1
Current behavior
Import validation fails
Expected behavior
Import validation succeeds
The text was updated successfully, but these errors were encountered: