Closed Trystan-SA closed 1 year ago
by default, vite-plugin-svelte searches for svelte.config inside vite root. You can change that by passing the path to svelte.config.js into it https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/config.md#config-file-resolving
// vite.config.ts
export default defineConfig({
root: 'src',
plugins: [
svelte({
configFile: '../svelte.config.js'
})
]
});
this is also logged at the very beginning.
vite:vite-plugin-svelte no svelte config found at E:/Projects/RootIssueVite/src +0ms
Describe the bug
When specifying the root option in vite.config.ts. It breaks Typescript and Sass/Scss code. It seems that code beginning with
<script lang="ts">
get treated like javascript code instead. The same behavior occurs when using Scss, vite seems to use it as CSS code only and raise an error when Scss features are used.Reproduction URL
https://github.com/Trystan-SA/RootIssueVite
Reproduction
npm install
npm run dev
You can test the behavior from the fileCounter.svelte
inside the lib folder.Logs
System Info