-
-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Css not getting imported #195
Comments
Not sure if this is related, but has a similar issue with the css build step breaking. This only started to happen after upgrading to svelte 4.* We had a number of modules imported that had the same prefix of Filenames
Modules {
"@rollup/plugin-commonjs": "^25.0.5",
"@rollup/plugin-json": "^6.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"rollup": "^4.0.2",
"rollup-plugin-import-css": "^3.3.5",
"rollup-plugin-inject-process-env": "^1.3.1",
"rollup-plugin-output-manifest": "^2.0.0",
"rollup-plugin-svelte": "^7.1.6",
"svelte": "^4.2.1"
} |
I'd highly recommend using Vite rather than Rollup for anything involving CSS |
I thought vite used rollup? We use esbuild in dev, rollup for production. Also this is called Are there plans to deprecate rollup? |
Describe the bug
Today i ran into a weird behaviour, which took a few minutes to debug, my folder structure:
Where the js file is a custom dom component which is styled in keyboard.css, then everything is nicely packed into a svelte component in keyboard.svelte.
but importing the style with import './keyboard.css'; in keyboard.svelte or keyboard.js did nothing. After digging around a bit i found that svelte gives the css/styles inside keyboard.svelte the id: './keyboard.css' (in the plugin transform call). rollup-plugin-css-only then skip's my file keyboard.css entirely. After renaming it everything works as expected.
Would be nice if svelte would rename the id if a file already exists with that name or at least show a warning.
Reproduction
Create a svelte component and a css file with the same name for example:
Then import the css in component.svelte.
Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: