如何解决Webpack 无法识别 css-loader
我的应用程序使用 yarn
正常运行,但是当我使用使用 webpack 的基准测试库 react-benchmark
时无法加载 css。整个项目的最小示例如下:https://github.com/dustinfreeman/bug-react-benchmark-css-import
这里是加载错误:
$ react-benchmark --debug src/index.tsx
✖ Compiling bundle
/Users/dustinfreeman/Documents/Code/bug-react-benchmark-css-import/src/index.css 1:5
Module parse failed: Unexpected token (1:5)
You may need an appropriate loader to handle this file type,currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> body {
| font: 14px 'Century Gothic',Futura,sans-serif;
| margin: 20px;
@ /Users/dustinfreeman/Documents/Code/bug-react-benchmark-css-import/src/index.tsx 3:0-21
@ ./client.js
webpack.config.js
export const module = {
rules: [
{
test: /\.(css|scss)$/,use: [
'style-loader',{
loader: 'css-loader',options: {
importLoaders: 1,modules: {
localIdentName: "[name]__[local]___[hash:base64:5]",},}
}
],include: /\.module\.css$/
},{
test: /\.(css|scss)$/,'css-loader'
],exclude: /\.module\.css$/
},],};
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。