Hi,
Thanks for the great tutorial. I have the configurations as explained in the tutorial but still css files are throwing error:
Module build failed (from ../node_modules/postcss-loader/src/index.js): Error: Cannot find module 'react-css-modules'
webpack.config.js:
{ test: /.css$/, use: [ { loader: 'style-loader', }, { loader: 'css-loader', options: { modules: { localIdentName: '[name]__[local]--[hash:base64:5]', }, sourceMap: true, importLoaders: 1, }, }, { loader: 'postcss-loader', }, ], },
postcss.config.js:
plugins: [ require('postcss-inline-svg'), require('postcss-import'), require('postcss-pxtorem')({...}), require('postcss-mixins')({...}), require('react-css-modules'), require('postcss-color-gray'), require('postcss-preset-env')({ browserslist: [...], stage: 3, features: { 'custom-properties': { preserve: false, }, 'nesting-rules': true, 'color-mod-function': { unresolved: 'warn' }, }, }), require('postcss-extend'), ],
.bablerc:
"plugins": ["@babel/plugin-proposal-object-rest-spread", "lodash", ["react-css-modules", { "webpackHotModuleReloading": true, "exclude": "node_modules", "generateScopedName": "[name]__[local]--[hash:base64:5]" } ] ],
Any idea what's going wrong here?
Looks like you've got 'react-css-modules' as a plugin in your PostCSS config? It doesn't belong there, its just a Babel plugin.
Thanks!! It worked.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi,
Thanks for the great tutorial.
I have the configurations as explained in the tutorial but still css files are throwing error:
Module build failed (from ../node_modules/postcss-loader/src/index.js):
Error: Cannot find module 'react-css-modules'
webpack.config.js:
{
test: /.css$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
options: {
modules: {
localIdentName: '[name]__[local]--[hash:base64:5]',
},
sourceMap: true,
importLoaders: 1,
},
},
{
loader: 'postcss-loader',
},
],
},
postcss.config.js:
plugins: [
require('postcss-inline-svg'),
require('postcss-import'),
require('postcss-pxtorem')({...}),
require('postcss-mixins')({...}),
require('react-css-modules'),
require('postcss-color-gray'),
require('postcss-preset-env')({
browserslist: [...],
stage: 3,
features: {
'custom-properties': {
preserve: false,
},
'nesting-rules': true,
'color-mod-function': { unresolved: 'warn' },
},
}),
require('postcss-extend'),
],
.bablerc:
"plugins": ["@babel/plugin-proposal-object-rest-spread", "lodash",
["react-css-modules", {
"webpackHotModuleReloading": true,
"exclude": "node_modules",
"generateScopedName": "[name]__[local]--[hash:base64:5]"
}
]
],
Any idea what's going wrong here?
Looks like you've got 'react-css-modules' as a plugin in your PostCSS config? It doesn't belong there, its just a Babel plugin.
Thanks!! It worked.