Skip to content
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

Cleanup prebundleSvelteLibraries #222

Closed
4 tasks done
bluwy opened this issue Dec 8, 2021 · 4 comments · Fixed by #294
Closed
4 tasks done

Cleanup prebundleSvelteLibraries #222

bluwy opened this issue Dec 8, 2021 · 4 comments · Fixed by #294
Assignees
Labels
enhancement New feature or request vite

Comments

@bluwy
Copy link
Member

bluwy commented Dec 8, 2021

Describe the problem

Fix the remaining issues for prebundleSvelteLibraries, which should be the correct way forward for Vite prebundling of Svelte libraries. Namely:

  • Automatic re-prebundle when svelte config change.
  • Allow deep importing Svelte components.
  • Allow importing libraries with a Svelte component entrypoint.
  • Make sure Vite 2.9 prebundling changes works

Some fixes may need to be in Vite core. Collecting these issue here so I don't forget, or if someone likes to tackle them.

Describe the proposed solution

Goal is to fix them by year end.

Alternatives considered

Not fix them by year end

Importance

would make my life easier

@bluwy
Copy link
Member Author

bluwy commented Feb 17, 2022

Update: no2 and no3 are being dealt at vitejs/vite#6801

@josdejong
Copy link

Short question: what will be the default behavior after this is finished? Will that be prebundleSvelteLibraries: true?

Background: I'm creating a sveltekit library (see here), but in order to be able to use it right now, every client has to configure kit.vit.optimizeDeps.include: [...list with commonjs deps...]. I noticed that this is not needed anymore when setting experimental.prebundleSvelteLibraries: true, which is great! So I hope this will become the default in the end: that will make using my library a breeze (just install and use, no extra config needed).

@bluwy
Copy link
Member Author

bluwy commented Mar 4, 2022

Hi. Ideally this will be the new default behaviour, but I would put it in a short experimental phase first just in case there are edge cases.

I'm creating a sveltekit library (see here), but in order to be able to use it right now, every client has to configure kit.vit.optimizeDeps.include: [...list with commonjs deps...]

This should be handled by default by vite-plugin-svelte already (nested/transitive dependency inclusion), so it's weird that that's needed for your library. I think the optimizeDeps.include can be removed now and it will work, but feel free to open an issue if it doesn't.

@josdejong
Copy link

josdejong commented Mar 4, 2022

Awesome!

Good to know that this is supposed to "just" work. I'll double check whether I'm using all the latest versions of svelte/kit/vite and verify whether optimizeDeps.include is still needed, if so I'll open a new issue, thanks Bjorn.

UPDATE: managed to get it working 🎉 . There where only two troublesome dependencies left, I could replace one and create a workaround for the other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request vite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants