问题描述
我的应用程序使用 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 (将#修改为@)