mirror of https://github.com/sveltejs/svelte
fix: avoid css tree-shaking for exported Snippet (#18540)
fix #16404 Currently one file can have multiple exports but only one `cssScopeTo` variable, which is hard coded to `default` inside vite-plugin-svelte. Therefore set hasGlobal to `true` in case we export a snippet to not have this scoping enabled in v-p-s --------- Co-authored-by: Simon H <5968653+dummdidumm@users.noreply.github.com> Co-authored-by: Simon Holthausen <simon.holthausen@vercel.com>pull/14594/merge
parent
6f5dd04a00
commit
b20b2ee85e
@ -0,0 +1,5 @@
|
||||
---
|
||||
'svelte': patch
|
||||
---
|
||||
|
||||
fix: avoid css tree-shaking for exported Snippet
|
||||
@ -0,0 +1,5 @@
|
||||
import { test } from '../../test';
|
||||
|
||||
export default test({
|
||||
hasGlobal: true
|
||||
});
|
||||
@ -0,0 +1,4 @@
|
||||
|
||||
.inner.svelte-xyz {
|
||||
color: red;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
<script module>
|
||||
export { outer };
|
||||
</script>
|
||||
|
||||
{#snippet outer()}
|
||||
<p class="inner"></p>
|
||||
{/snippet}
|
||||
|
||||
<style>
|
||||
.inner {
|
||||
color: red;
|
||||
}
|
||||
</style>
|
||||
Loading…
Reference in new issue