the behavior of css-loader is different in version @6 and version @7 with css modules
Closed this issue · 1 comments
Bug report
Actual Behavior
I applied this loader to webpack, but the behavior of css-loader is different in version @6 and version @7 with css modules. One retrieves an undefined, while the other can correctly retrieve an object. However, I don't seem to have found any documentation that explains this change.
The current versions of my packjson are as follows:
{
"devDependencies": {
"@babel/core": "^7.24.6",
"@babel/preset-env": "^7.24.6",
"@babel/preset-react": "^7.24.6",
"babel-loader": "^9.1.3",
"css-loader": "^7.0.0",
"html-webpack-plugin": "^5.6.0",
"style-loader": "^4.0.0",
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
},
"dependencies": {
"@types/react": "^16.14.0",
"@types/react-dom": "^16.9.0",
"react": "^16.14.0",
"react-dom": "^16.14.0"
}
}another @6 packjson are as follows, only css-loader version different
{
"devDependencies": {
"css-loader": "^6.11.0",
}
}
Expected Behavior
I hope that version @7 can have consistent behavior with version @6. Currently, I have already resolved this issue by downgrading the version.
How Do We Reproduce?
demo address -> https://github.com/semi-xi/my-mini-project
Please paste the results of npx webpack-cli info here, and mention other relevant information
System:
OS: macOS 14.3.1
CPU: (10) x64 Apple M1 Pro
Memory: 21.23 MB / 16.00 GB
Binaries:
Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
Yarn: 1.22.22 - ~/.yarn/bin/yarn
npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
Browsers:
Chrome: 125.0.6422.114
Safari: 17.3.1
Packages:
babel-loader: ^9.1.3 => 9.1.3
css-loader: ^7.0.0 => 7.0.0
html-webpack-plugin: ^5.6.0 => 5.6.0
style-loader: ^4.0.0 => 4.0.0
webpack: ^5.91.0 => 5.91.0
webpack-cli: ^5.1.4 => 5.1.4
webpack-dev-server: ^5.0.4 => 5.0.4
Please read migration guide if you want to achive the old behaviour - https://github.com/webpack-contrib/css-loader/releases/tag/v7.0.0
Feel free to feedback

