-
-
Notifications
You must be signed in to change notification settings - Fork 535
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
Module not found: Package path ./node is not exported from package ./node_modules/msw #1705
Comments
Hi, @kmiwa007. Thanks for reporting this. As I see, this error is thrown by Next.js compilation itself, isn't it? Right now, MSW doesn't officially support any version of Next, as there have been some internal changes in Next.js that prevent MSW from functioning correctly. We've raised this with the Next.js team and you can follow the progress on this issue as well as contribute to it here: #1644. Unfortunately, until that's addressed we won't be accepting Next.js-related issues. |
The same happens in Remix v2 which runs on Node 18, I don't believe it's related to anything Next.js specific. |
@egorpavlikhin, can you please submit a reproduction repository for that behavior? I've got a fully functional Remix V2 app with MSW without any module errors. |
@kettanaito I'm seeing this issue with Remix v2 also, repro here: https://github.com/patrickweaver/msw-remix |
My solution (for Remix) was moving
/**
* By default, Remix will handle generating the HTTP Response for you.
* You are free to delete this file if you'd like to, but if you ever want it revealed again, you can run `npx remix reveal` ✨
* For more information, see https://remix.run/file-conventions/entry.server
*/
import { PassThrough } from "node:stream";
import type { AppLoadContext, EntryContext } from "@remix-run/node";
import { createReadableStreamFromReadable } from "@remix-run/node";
import { RemixServer } from "@remix-run/react";
import { isbot } from "isbot";
import { renderToPipeableStream } from "react-dom/server";
import { server } from "./mocks/node";
const ABORT_DELAY = 5_000;
if (process.env.NODE_ENV === "development") {
server.listen();
}
/* ... rest of code ... */ |
@kettanaito @amanape I'm also facing same issue mentioned above, but in my case it's a mono repo angular application. Where should I place server.listen() in angular application?. As per some suggestion, placed under environment.ts file, still I'm getting same error, environment.e2e.ts:import { server } from '../mocks/msw-server-setup'; export const environment = { project.json: (project-name - uem-mod-ui)targets => build => configurations => Running application using below command: |
Prerequisites
Environment check
msw
versionNode.js version
v18.16.0
Reproduction repository
N/A
Reproduction steps
Using
"msw": "^0.0.0-fetch.rc-16",
and"next": "^12.3.4",
.Current behavior
Throw error
Expected behavior
No import error
The text was updated successfully, but these errors were encountered: