-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
fix: ssrExternal
should not skip nested dependencies
#7154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. I don't see any edge case with this at the moment, but would be a good candidate for the beta.
I just realized something. When vite-plugin-svelte starts providing support to prebundle svelte libraries, this wouldn't really be useful anymore since we don't add |
Even if Svelte doesn't use the |
I don't think there's a bug since Vite currently ignores these sort of syntax as expected. We can still merge this though, but it leads to extra valid |
Is it expected that Vite ignores dependencies with the |
Yeah I think it is expected that Vite ignores But putting it another way, if we have |
Hmm. The plugins are adding the
I'm not sure I would expect this to error out regardless of what |
We're currently adding
The import scanning currently only does a shallow scan (it doesn't scan the However, in doing so the dependencies of This is my observation so far though. Maybe Vite should be auto-externalizing transitive deps by default, but I'm not sure how to fix this yet. |
Vite can and should
Yes, I think Vite should externalize everything by default. I took a stab at that earlier (#6698), but one of the tests was failing and I didn't have time to investigate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking about this again, and I suppose this should be fine to merge. The reason I was initially oppose was that having parent > child
's child
part externalized would externalize it everywhere in the code, but I think getting more known imports shouldn't cause any side effects since the more we can use Node to import, the better.
Description
ssrExternal
is skipping nested dependencies causing breakages during SSRAdditional context
Before digging into this, I suspected it was an issue in
vite-plugin-svelte
and filed an issue there: sveltejs/vite-plugin-svelte#281. It turned out to be an issue in Vite insteadWhat is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).