Repository navigation
fix(vite): resolve dev externals without the development condition - #4996
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
FindingsActionable comments posted: 2 Caution Review failedThe pull request is closed.
|
| Layer / File(s) | Summary |
|---|---|
Parse and filter Node conditions src/build/vite/env.ts |
_nodeConditionsFlag reads condition values from process.execArgv and NODE_OPTIONS. _externalConditions excludes development and production unless Node receives them, while retaining the existing exclusions. |
Verify external package resolution test/vite/external-conditions-fixture/vite.config.ts, test/vite/external-conditions-fixture/server.ts, test/vite/external-conditions.test.ts |
The fixture returns values from the app and consumer packages. The integration test checks that both values are default. |
Estimated code review effort: 2 (Simple) | ~12 minutes
Change: Bug fix · Severity of issue fixed: Medium
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
commit: |
Node resolves the imports inside externalized dependencies without it, so resolving the app's own imports with it loaded a second copy (#4994).
faa727c to
231f15f
Compare
Resolves #4994
In
vite dev, Vite resolves the app's imports of externalized dependencies with the nitro environment'sexternalConditions, which includeddevelopment. Node then resolves the imports inside those files with its own conditions, withoutdevelopment. A package with adevelopmentexport that another external also imports loaded twice (development build for the app, default build for the other dependency), breaking cross-copy checks such as seroval's.This drops the mode conditions (
development/production) from the external conditions, matching Vite's own default (["node", "module-sync"]) and the production build. They stay inresolve.conditionsfor inlined code.test/vite/external-conditions.test.ts(failed before: app gotdevelopment, consumerdefault).dual, seroval streamok.🤖 Generated with AI assistant