-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Regression in CSS output location #15141
Comments
if you set this contains "src/lib/example.js": {
"assets": [
"assets/fira-mono-cyrillic-ext-400-normal-dOGCK5uJ.woff2",
/* ... */
],
"css": [
"assets/lib/example-XpY97b8p.css"
],
"file": "lib/example-jnbdGhTu.js",
"isDynamicEntry": true,
"isEntry": true,
"src": "src/lib/example.js"
}, so in a nested entry, the information does exist. However, diffing the manifests generated by vite4 and vite5 shows that the vite5 manifest conains less top level entries, notably "src/assets/svelte.svg": {
"file": "assets/svelte-a39f39b7.svg",
"src": "src/assets/svelte.svg"
},
"src/lib/example.css": {
"file": "assets/example-507eca81.css",
"src": "src/lib/example.css"
}, are only present in vite4 manifest. It also looks like vite5 inlines the svelte svg into main js, while vite4 puts it in assets instead. |
note to others looking at the names and wondering why they might be different, the vite.config.js in the reproduction has custom config https://github.com/benmccann/vite5-css-reproduction/blob/master/vite.config.js#L5 |
The issue is that the CSS file is output in the wrong location. E.g. it's at |
this seems to be caused by the |
Is this an intentional change? To illustrate the changes in manifest.json generation I created a minimal project. --- a/dist/manifest.json
+++ b/dist/manifest.json
@@ -1,13 +1,9 @@
{
- "main.css": {
- "file": "assets/main-829fb0a8.css",
- "src": "main.css"
- },
"main.js": {
"css": [
- "assets/main-829fb0a8.css"
+ "assets/foo-sok_4qEN.css"
],
- "file": "assets/foo-b8911e79.js",
+ "file": "assets/foo-TcdXag5j.js",
"isEntry": true,
"src": "main.js"
} This change breaks my backend integration with vite, as I need to find the css file that is related to JS entry point separately |
I added a new ticket #15161 since this was initially related to a wrong asset URL |
Describe the bug
CSS is output to a different location.
That location doesn't match the location in the manifest andthe change in location breaks SvelteKit users upgrading to Vite 5 because it breaks relative links to font files and potentially other assets: sveltejs/kit#11085We could work around it on the SvelteKit side by changing the left hand side of the
input
object in the Vite config, but the workarounds have some issues. E.g. I could replace/
with_
, but then the file names get to be awkwardly long and show up differently in the Chrome network tab. If I try to just strip the portion before/
then I run into the danger of overwriting the input entries for files with the same name living in different directories.Reproduction
https://github.com/benmccann/vite5-css-reproduction
Steps to reproduce
pnpm install && pnpm build
Vite 5 produces CSS at
dist/assets/lib/example-XpY97b8p.css
Vite 4 produces CSS at
dist/assets/example-507eca81.css
System Info
Used Package Manager
pnpm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: