问题
When running Webpack, I get the following error:
./src/css/main.css 3.62 KiB {0} [not cacheable] [built] [failed] [1 error]
ERROR in ./src/css/main.css Module build failed (from ./node_modules/css-loader/dist/cjs.js): ... accumulator[normalizedUrl] = { ...accumulator[normalizedUrl], ^^^ ...
webpack.config.js:
module: {
rules: [
{
test: /\.css$/i,
use: ['css-loader']
}
]
}
css:
body {
background-color:purple;
}
js:
import css from '../css/main.css';
on js file, if I enter
import '../css/main.css';
I get the same error.
I'd appreciate your help please.
回答1:
Resolved the issue by upgrading node.
来源:https://stackoverflow.com/questions/61830978/webpack-getting-this-error-build-failed-from-node-modules-css-loader-dist-c