0
我試圖在我的reactjs應用程序中包括字體真棒,這些都是我遵循的步驟。'字體真棒'適當的加載程序來處理
1. npm install --save font-awesome
2. Import it to my jsx file
import '../../../../../../node_modules/font-awesome/css/font-awesome.min.css';
3. Adding url-loader to my webpack.config.js
{
test: /\.(woff|woff2|eot|ttf)(\?.*$|$)/,
loader: 'url-loader?limit=100000'
}
但我收到了這個問題。我該如何解決這個問題?
../~/font-awesome/css/font-awesome.min.css 模塊解析失敗:C:\用戶\管理員\文件\ revegator平臺\ node_modules \字體真棒\ CSS \字體-awesome.min.css意外字符'@'(4:3) 您可能需要一個合適的加載程序來處理此文件類型。
我webpack.config.js
'use strict';
let path = require('path');
module.exports = {
entry: path.resolve('./src/main.js'),
output: {
path: path.resolve('../public/js'),
filename: 'build.js'
},
resolve: {
extensions: ['.js', '.jsx', '.json']
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.s[a|c]ss$/,
loader: 'style-loader!css-loader!sass-loader'
},
{
test: /\.(png|jpg|gif|svg)$/,
loader: 'file-loader',
options: {
name: '[name].[ext]?[hash]'
}
}
]
}
};