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

fix(vite): set ssr.noExternal even if not in project package.json #404

Merged
merged 4 commits into from
Oct 18, 2024

Conversation

mcous
Copy link
Collaborator

@mcous mcous commented Oct 11, 2024

If @testing-library/svelte is not set in the package.json of the project Vitest is running in (e.g. in certain monorepo setups), @sveltejs/vite-plugin-svelte will not detect that it needs to be inlined. This, in turn, breaks Svelte 5 support, which relies on STL running through the Svelte compiler for runes support.

Hopefully this is something that can be fixed in @sveltejs/vite-plugin-svelte, but it might not be! This PR updates our own Vite plugin to ensure this setting is correct, even if @sveltejs/vite-plugin-svelte misses it.

Fixes #403

@mcous mcous mentioned this pull request Oct 11, 2024
@mcous
Copy link
Collaborator Author

mcous commented Oct 11, 2024

Setup file has issues in the same monorepo setup this PR sets out to address, see playerfine/svelte5unittestingexample#1 (comment)

TODO

  • Disable auto cleanup if Vitest is in globals mode
  • Figure out why cleanup setupFiles addition fails in a monorepo, adjust as necessary
    • Cause: misconfiguration in example monorepo, Vitest and plugin behaving as expected

@mcous mcous merged commit b5e0f3d into main Oct 18, 2024
27 checks passed
@mcous mcous deleted the fix-monorepo-noexternal branch October 18, 2024 16:13
Copy link

🎉 This PR is included in version 5.2.4 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Svelte 5 rendering in Nx
1 participant