-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Two different versions of a dependency (direct + transitive) breaks dev build #3254
Comments
#3053 PR also causes the same regression bug as #3003 . @nihalgonsalves |
Confirmed that this bug is still present in 2.3.0. |
patak-dev
pushed a commit
that referenced
this issue
Jun 27, 2021
* fix: resolve nested dependencies (#3254) * chore: inline packages * chore: force optimize * chore: cleanup Co-authored-by: Anthony Fu <[email protected]>
Also present in 2.3.8 |
4 tasks
Thanks @veltman, looks like GitHub interpreted from the description that this should be closed. As you said, a fix had to be reverted because of regressions. Another solution is required here. |
Yelmor
added a commit
to Yelmor/vite
that referenced
this issue
Jul 3, 2021
9 tasks
patak-dev
pushed a commit
that referenced
this issue
Jul 14, 2021
aleclarson
pushed a commit
to aleclarson/vite
that referenced
this issue
Nov 8, 2021
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
It appears that if you have two different versions of a package in your dependency tree and a file that uses both versions (one directly, one indirectly), then the dev build will resolve all references using a single version during prebundling, instead of using the locally correct version for each bundle.
I didn't see any config options that would address this, let me know if I'm missing something obvious!
Steps to reproduce
npm init @vitejs/app
npm install && npm install @tidyjs/[email protected] [email protected]
main.js
with:npm run dev
More info
In this case your package.json has:
So you end up with the installed dependencies:
When your main.js contains something like:
then
npm run dev
will produce errors when trying to prebundle tidy:This is seemingly because it's using the direct dependency version of d3-array ([email protected]) instead of the version that tidy depends on (d3-array^2.9.1), even though both are installed.
In this case the failure is obvious because the exported API of d3-array changes in v2, but this could also fail more insidiously since two different versions could have the same named exports but different internal behavior, so then the difference would only show up at runtime.
Note: I couldn't reproduce this same issue using esbuild directly, so the issue seems specific to the way in which vite is using it.
The text was updated successfully, but these errors were encountered: