Closed typhonrt closed 11 months ago
This is not a bug in vite-plugin-svelte. To silence the warning until a fix has been made in svelte-preprocess, you can use onwarn in the config and ignore the code vite-plugin-svelte-preprocess-depends-on-self
please follow the issue in svelte-preprocess https://github.com/sveltejs/svelte-preprocess/issues/619
Yeah.. Apologies for the churn. I figured it would be good to at least have something in the issues here as it is not clear where the bug occurs. I spent a good bit of time tracing it back to svelte-preprocess
through the Vite plugin code; over an hour of time. Having it in the issues here might help someone else doing the same. I checked various Svelte repos initially for existing issues, but svelte-preprocess
was not an obvious one to check.
Describe the bug
Greets,
With the latest
vite-plugin-svelte
/3.0.1
/ Svelte4.2.8
/ Vite5.0.10
/ svelte-preprocess5.1.2
there is a situation for voluminous warning messages generated. I have an investigation into the code points where this is generated invite-plugin-svelte
and have narrowed things down. The main cause / symptom is using Sass in Svelte components via<style lang="scss"></style>
blocks. Convert things over to normal CSS<style></style>
and the warnings go away.With the latest
3.0.x
release checking of dependencies output by the Svelte compiler / preprocessor was added insrc/utils/preprocess.js
via the newcheckPreprocessDependencies
function. I tracked the issue throughsvelte-preprocess
and it appears the problem is in thescss
transformer as it does file path comparisons between Posix & Windows paths thus not being equal thereby adding an erroneous "dependency". Quite possibly other transformers are also doing path comparisons incorrectly.I figured it might be a good idea to open an issue here as well since this likely will be something that comes up for many potentially using Windows. I only found the related issue in
svelte-preprocess
after tracing things for 1+ hours. The problem is insvelte-preprocess
, but is exposed by the latestvite-plugin-svelte
.Related: https://github.com/sveltejs/svelte-preprocess/issues/619
Reproduction URL
https://github.com/richardfxr/sveltekit2-preprocess-dependency-issue
Reproduction
I used another fellows reproduction case from
svelte-preprocess
/ Issue619
. I verified that I see the same result.1) On Windows / non-Unix / Posix OS. 2) Use
svelte-preprocess
withscss
style block in Svelte components 3) See all the new errant dependency warnings.In the repo linked run
npm run build
and you'll see the warnings on a Windows box.Logs
No response
System Info