'Error: No known conditions for "./node" specifier in "msw" package' when using MSW with Vitest
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Active
- Tech stack
- typescript, vite
- Domain
- testing-qa, tooling
Research direction
Start with the import of msw/node in src/testfile.test.ts and reproduce it under Vitest with the plugin enabled. Compare the result after removing the plugin, then trace the reported Vite resolution error to determine whether the plugin or MSW causes it. Done means the import works with the plugin present and the error no longer occurs.
Written by the indexing model from the issue text.
Description
Trying to import and use any function from MSW (specifically, msw/node) when running vitest prints this error:
FAIL src/testfile.test.ts [ src/testfile.test.ts ]
Error: No known conditions for "./node" specifier in "msw" package
❯ e node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:21445:25
❯ n node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:21445:646
❯ o node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:21445:1297
❯ resolveExportsOrImports node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28746:20
❯ resolveDeepImport node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28765:31
❯ tryNodeResolve node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28453:20
❯ Context.resolveId node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:28212:28
❯ Object.resolveId node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:44276:32
❯ TransformContext.resolve node_modules/.pnpm/vite@4.5.0_@types+node@20.8.10/node_modules/vite/dist/node/chunks/dep-bb8a8339.js:43992:23
This only happens when this plugin is present, removing it seems to fix the issue.
Not sure if this is a bug in the plugin, or a problem on msw's side, or if I'm maybe doing something wrong?
- Dominant language
- TypeScript
- Stars
- 520
- Forks
- 70
- Avg merge
- 23h 35m
- Merged PRs (30d)
- 39
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from solidjs/solid-vite-plugin
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
solidjs/solid-vite-plugin#205 · 1 comment · 2 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
solidjs/solid-vite-plugin#369 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
solidjs/solid-vite-plugin#328 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
solidjs/solid-vite-plugin#308 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
solidjs/solid-vite-plugin#262 · 2 comments ·
All issues in solidjs/solid-vite-plugin
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·