externalized packages aren't traced properly
See original GitHub issueEnvironment
- Operating System: Linux
- Node Version: v18.7.0
- Nitro: latest
Reproduction
https://github.com/mahdiboomeri/nitro-externalized-issue
my older reproduction for context: https://github.com/mahdiboomeri/nuxt3-externalized-issue
Describe the bug
related to https://github.com/nuxt/framework/issues/7105 and #515
When using packages with the same dependency but conflicting versions, the externalized dependency files arenβt traced properly. (sorry if itβs a bit unclear this was the best way i could explain it)
for example in the reproduction repo iβm using sharp
and jsonwebtoken
which both rely on different versions of semver
.
I get the following file structure in .output/server/node_modules/semver
- π semver
- π classes
- π semver.js
- π functions
- π coerce.js
- π compare.js
- π gte.js
- π parse.js
- π internal
- π constants.js
- π debug.js
- π identifiers.js
- π parse\-options.js
- π re.js
- π package.json
What it should be
- π semver
- π classes
- π comparator.js
- π range.js
- π semver.js
- π functions
- π clean.js
- π cmp.js
- π coerce.js
- π compare\-build.js
- π compare\-loose.js
- π compare.js
- π diff.js
- π eq.js
- π gt.js
- π gte.js
- π inc.js
- π lt.js
- π lte.js
- π major.js
- π minor.js
- π neq.js
- π parse.js
- π patch.js
- π prerelease.js
- π rcompare.js
- π rsort.js
- π satisfies.js
- π sort.js
- π valid.js
- π internal
- π constants.js
- π debug.js
- π identifiers.js
- π parse\-options.js
- π re.js
- π ranges
- π gtr.js
- π intersects.js
- π ltr.js
- π max\-satisfying.js
- π min\-satisfying.js
- π min\-version.js
- π outside.js
- π simplify.js
- π subset.js
- π to\-comparators.js
- π valid.js
- π index.js
- π package.json
- π preload.js
I understand the issue isnβt related to these specific packages, you can find more examples in the https://github.com/nuxt/framework/issues/7105 comments
Additional context
This was partially fixed in #515 but the problem is still there
Logs
No response
Issue Analytics
- State:
- Created 10 months ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top GitHub Comments
hi @itpropro Thanks for the further explanation, Based on what you described I think youβre right. I didnβt have much context on #612 other than the reproduction thatβs why they sounded different to me i mananged to find some success in fixing the issue with just hacking around, iβm working on a better fix, if it works I probably make a PR
Hi @mahdiboomeri, I think itβs actually the same issue. The behavior you describe is exactly the same I experienced with e.g. the @azure/identity package. It happens after the build and Nitro throws multiple warning about different versions and that it is picking the newest one. #612 should also be fixed, if all packages are considered for the bundle if they are referenced by a package or a dependency.
EDIT: Here is a updated screenshot from #612 from one of my projects that still throws the warnings with the current nitropack-edge version. I hope we find a fix for this soon π