Webpack plugin doesn't handle css modules #962
-
CSS modules work in development, but not when built with webpack plugin. Repro repository: https://github.com/toneb/snowpack-webpack-bug The problem is in css-loader rule where modules have to be explicitly enabled. But enabling them would then break non-modules css. The issue can be fixed by changing the css rule in webpack plugin to two separate rules for css, and css modules: {
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: 'css-loader',
options: {
importLoaders: 1,
modules: true
}
}
],
include: /\.module\.css$/
},
{
test: /\.css$/,
use: [
{
loader: MiniCssExtractPlugin.loader,
},
{
loader: "css-loader",
}
],
exclude: /\.module\.css$/
}, |
Beta Was this translation helpful? Give feedback.
Answered by
FredKSchott
Aug 29, 2020
Replies: 1 comment 1 reply
-
Ah, good catch! Would love to accept a PR that implements this! nit picky question: would this work as well?
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
toneb
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ah, good catch! Would love to accept a PR that implements this!
nit picky question: would this work as well?