-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
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
Vite renaming CSS Modules filenames during build #13401
Comments
Start a new pull request in StackBlitz Codeflow. |
IIUC, this is your expected output:
|
Indeed @faga295, would expect something along those lines; a way to tell " |
This is fixed in #14945. On stackblitz, the manifest looks like this now Details{
"counter.js": {
"css": [
"assets/counter-8mkbkWOV.css"
],
"file": "assets/counter-JhrRzO5T.js",
"isDynamicEntry": true,
"src": "counter.js"
},
"index.html": {
"css": [
"assets/index-Cw8cJx0e.css"
],
"dynamicImports": [
"counter.js"
],
"file": "assets/index-WIyQ0__r.js",
"isEntry": true,
"src": "index.html"
}
} It however still doesn't contain the information you need, but I think that's correct as To get the files that consist within I've updated your plugin in the repro to do this: new stackblitz link |
Describe the bug
Hi 👋
I'm trying to figure out if any given CSS asset in my build includes CSS Modules-hashed selectors.
During
vite dev
it is pretty easy because the injected<style>
tags include the CSS source filename as data attributes, e.g.:data-vite-dev-id="/home/projects/vitejs-vite-azu81e/Isolated.module.css"
But on
vite build
it is renaming[name].module.css
id to[js_file_name_that_imports_it]-[hash].css
.This wouldn't be a problem except for the fact that the source file is also renamed in the manifest as well:
I don't understand where
counter.css
comes from. This file doesn't exists in my working tree.I understand why would you want to have
counter-[hash].css
named chunks, since one might want to merge several CSS sources into a single asset. But not having a trace to the source file sounds like a bug to me.I'm trying to create my own mapping with a custom plugin. I can see the original
.module.css
source file name in theload()
andtransform()
plugin hooks, but I don't seem to find any way to trace their journey tocounter-[hash].css
.Am I missing something?
Reproduction
https://stackblitz.com/edit/vitejs-vite-azu81e?file=dist%2Fmanifest.json&terminal=dev
Steps to reproduce
Check the
manifest.json
file. You can re-build by opening a new terminal tab in StackBlitz and runningnpm run build
System Info
System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 16.14.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 7.17.0 - /usr/local/bin/npm npmPackages: vite: ^4.3.9 => 4.3.9
Used Package Manager
npm
Logs
Validations
The text was updated successfully, but these errors were encountered: