Answer the question
In order to leave comments, you need to log in
How to include global styles in a project where css-modules is used?
For the project I use the React-Quill package https://github.com/zenoamaro/react-quill, it is indicated that you can import styles `import 'react-quill/dist/quill.snow.css'. `
Such an import into the project component does not include styles, since the project uses css-modules. How to import styles in this case?
webpack config
{
test: /\.css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
module: true,
importLoaders: 1,
localIdentName: '[path][name]__[local]'
}
},
{
loader: 'postcss-loader'
}
]
},
@import '../../../../../../node_modules/react-quill/dist/quill.snow.css';
:global{
@import '../../../../../../node_modules/react-quill/dist/quill.snow.css';
}
Answer the question
In order to leave comments, you need to log in
include the module in webpack and paste it as in the description of the npm package into the component
import 'react-quill/dist/quill.snow.css';
module.exports = {
module: {
rules: [
{
test: /\.css$/,
use: [ 'style-loader', 'css-loader' ]
}
]
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question