Make the experimental node loader handle CJS to ESM conversion
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript, vite
- Domain
- devtools, testing-qa, tooling
Research direction
No files, tests, or specific entry points are named. Start by locating Vitest's experimental node loader and its dependency inlining path, then compare the intended CJS-to-ESM handling with the tsx approach mentioned. Done means affected packages such as lodash work without inlining the entire transitive dependency chain.
Written by the indexing model from the issue text.
Description
Clear and concise description of the problem
Some packages export CJS entry points that have bad named exports for the ESM named exports heuristic employed by node. Those work with plain Vite but fail with vitest. (e.g. lodash)
To support them you currently need to deps.inline them, which also requires inlining any module that transitively imports such problem modules.
Suggested solution
The experimental node loader can handle such conversion without requiring to inline the entire dependency chain. Similar to how tsx works.
Alternative
Keep inlining the entirety of such dependency chains, or don't use such named imports from problem packages.
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
- Dominant language
- TypeScript
- Stars
- 17.1k
- Forks
- 2k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 92
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 vitest-dev/vitest
-
pending triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
vitest-dev/vitest#11276 · 3 reactions ·
-
p3-minor-bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
vitest-dev/vitest#11144 · 1 comment ·
-
pending triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
vitest-dev/vitest#11019 · 5 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
vitest-dev/vitest#10940 ·
-
p2-nice-to-have
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
vitest-dev/vitest#10793 · 1 comment ·
All issues in vitest-dev/vitest
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·