-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
feat: optimize custom extensions #6801
Conversation
This looks good, I'll add it to be discussed in the next team meeting.
The extra pre-bundling time should be less noticeable if we get to merge #6758, and make the dep optimization processing non-blocking. |
@bluwy we talked about this PR in the last team meeting. This is a feature that we want to support in Vite. Not only it will benefit svelte, but as you said it could be used by Vue and other frameworks to do the same. We would like to explore an alternative approach though, to be able to avoid forking the pipeline and require dual implementations of each plugin (svelte, vue, etc). The ideal would be that the same Vite/Rollup plugins are used for deps, as we currently do when we exclude them from pre-bundling. Evan and Anthony proposed to see if something like unplugin could work here, wrapping the normal plugins to make them compatible (at least for what is supported) with esbuild. So for users, this will be as transparent as possible, and we also are more abstracted from esbuild in the case at some point we decide to switch to a different tool. |
Thanks for looking into this! Yeah the PR now is definitely not the long-term solution, so an alternative approach is certainly welcomed. I've thought about some unified approaches too, but ultimately it comes down to intricacies of handling CSS, prebundling invalidation, and special prebundling logic that would need I still hope that this PR can be considered though, at least under the experimental status as it's mostly additive. I can find some time to look into the above ideas too, but I'm hoping the Svelte ecosystem can get an improved prebundling experience while we're at it. |
Lets talk about it again in the next team meeting. Marking it as experimental sounds like an option we should consider |
From the last team meeting, we've agreed to move forward with this. The |
Started a discussion to gather feedback so we can move this feature out of experimental: |
Description
Add
optimizeDeps.extensions: string[]
to pre-bundle custom extensions. A respective esbuild plugin is required to handle that extension. e.g.['.svelte', '.svelte.md']
.Additional context
A corresponding branch in vite-plugin-svelte is created that's based on this PR, under the flag
experimental.prebundleSvelteLibraries
. You can try it out as well invite-plugin-svelte
'sbig-component-library
playground, after linking Vite locally.I've also tested this on a production app and it's working nicely so far. Pre-bundling time is up slightly, but browser load time is noticably faster.
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).