Skip to content

Commit e050541

Browse files
authored
fix: use the resolved vite root (#247)
* fix: use the resolved vite root Although vite-plugin-svelte needs to infer a root in order to pre-scan svelte dependencies, it should use the root returned in configResolved to ensure compatibility with backend integrations and other plugins that might modify the root. Since vite-plugin-svelte uses `enforce: 'pre'`, it's not viable for other plugins to workaround this by using `enforce: 'pre'`, since the behavior would become order-dependent on how the user applies the plugins, which is error-prone and would result in a bad user experience. * chore: add changeset
1 parent 9416dd2 commit e050541

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

.changeset/popular-tigers-camp.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/vite-plugin-svelte': patch
3+
---
4+
5+
use the resolved vite root to support backend integrations

packages/vite-plugin-svelte/src/utils/options.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ export function resolveOptions(
112112
...defaultOptions.compilerOptions,
113113
...preResolveOptions.compilerOptions
114114
},
115+
root: viteConfig.root,
115116
isProduction: viteConfig.isProduction
116117
};
117118
addExtraPreprocessors(merged, viteConfig);

0 commit comments

Comments
 (0)