I am running into a problem with my build, when I run yarn build, I get Module not found: Error: Package path ./node is not exported from package /Users/******/Desktop/project/frontend/node_modules/msw.
To put more context I run my app with CRA, state management with RTL, MSW V2.0.13 and testing with react-testing library, my api call are made with Redux Toolkit Query I am testing both for Browser and Node, my node.ts is the following:
import { setupServer } from "msw/node"
import { agentHandlers } from "./handlers/agent-handler"
import { mfaHandlers } from "./handlers/mfa-handler"
import { tokenHandler } from "./handlers/token-handler"
// Configures the mock service worker for node
export const server = setupServer(...[...mfaHandlers, ...agentHandlers, tokenHandler])
My question is, can the issue be related to MSW, Yarn (that btw I migrated from V1 to V4), or a small thing that I am missing, thank you in advance
I tried to remove node_modules, yarn.lock, package.json and run yarn install but nothing seems to work...