Description
Describe the problem
Hi!
I have been struggling with migrating a Svelte project from webpack to vite, and finally came to a breakthrough when I realized my svelte.config.js
had to be moved to a different directory (./app
instead of .
) to be detected by vite
/vite-plugin-svelte
For the sake of making that issue easier to find by people going on the same road, here is the kind of error message I was getting with my config in the wrong place:
error during build:
[vite-plugin-svelte] [plugin vite-plugin-svelte] app/path/to/component.svelte (89:2): app/path/to/component.svelte:89:2 Expected a valid CSS identifier
https://svelte.dev/e/css_expected_identifier
- Did you forget to add a scss preprocessor? See https://github.com/sveltejs/vite-plugin-svelte/blob/main/docs/preprocess.md for more information.
Describe the proposed solution
enhanceCompileError
was reporting that no preprocessor was set, but would have saved me a good amount of banging my head on the wall had it told me that no config was found at all.
Also logging the path where the config file would be expected would be great (my breakthrough came after I ran vite --debug
and realized that vite
was looking for env files in ./app
)
Alternatives considered
Giving up and becoming a goat keeper
Importance
would make my life easier