-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Deps Pre-optimization does not exclude nested deps #5688
Comments
I can confirm this too. I had always assumed this to be intentional since prebundling is always necessary for third-party libraries. Or it would cause the duplication issue as mentioned. Is there a reason to exclude |
Some packages might be relying on the internal singleton states (in my case is import Vue from 'vue'
Vue.use(SomePlugin) import Vue from 'vue'
Vue.$someplugin() // if the `vue` is not the same vue, it will failed. So I guess at least we should support something like: (similar to the include pattern https://vitejs.dev/config/#optimizedeps-exclude) optimizeDeps: {
exclude: [
'* > vue-demi'
]
} |
We also had the same singleton issue for Svelte as well. The solution was to force |
Yeah, the problem is that we want to do some aliasing here so we have to opt-out of those dependencies. If we exclude one sub dependencies (vue-demi) which make all packages on top of it also be excluded from the optimization (otherwise it would still have duplications). From Nuxt's perspective, it's impossible to list all the packages relying on I will see what I can improve it and drop a PR soon |
Hey @antfu Loved your talk 2 days ago :) But I'm also looking intro upgrading to nuxt 3.2 but I now also face the same issue.
It's from a package which has vue-demi as a nested dependency. |
Hi. Is there any workaround? I was using optimizeDeps: {
exclude: [
"fsevents",
"@node-rs",
"@napi-rs"
],
}, to prevent error like this
And it worked until I moved this code in sub-module. Now it doesn't work anymore |
Describe the bug
For example, we have
@vueuse/core
relying onvue-demi
, if we exclude the optimization forvue-demi
(but not@vueuse/core
) viaWhich the nested
vue-demi
does not been excluded from the optimized bundle for@vueuse/core
. Causing the potential duplication for deps.Related nuxt/bridge#186
Reproduction
(Just creating a quick issue for tracking, will fulfill the repro and make the PR soon)
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: