webpack加载css文件
css-loader-error.pngModule parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
参考链接:
https://stackoverflow.com/questions/42530582/css-module-parse-failed css-module-parse.png
webpack无法正确加载css文件,需要在webpack.config.ts中加入css-loader
// 首先要安装style-loader css-loader
npm install --save-dev style-loader css-loader
修改配置
module: {
rules: [
{
/** 其它loader **/
},
{
test: /\.css$/,
exclude: /node_modules/,
use: ['style-loader', 'css-loader'],
},
],
},
Eslint忽略css文件
css-parse-error.png[unknown]: Parsing error: ';' expected.
https://stackoverflow.com/questions/63596271/webpack-with-css-loader-parsing-error-expected
修改webpack.config.ts,配置eslint不检查css文件
plugins: [
new ForkTsCheckerWebpackPlugin({
async: false,
eslint: {
files: ['./src/**/*.js', './src/**/*.ts', './src/**/*.tsx'],
},
}),
],
网友评论