我尝试导入fontawesome.scss,但似乎我做错了方法。所以这是我做的:
npm install @fortawesome/fontawesome-free
file-loader
配置了webpack.config.js
{
test: /\.(woff(2)?|ttf|eot|svg)(\?v=\d+\.\d+\.\d+)?$/,
use: [{
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'fonts/'
}
}]
}
试图将所有内容导入我的main.scss文件
$fa-font-path: "../../node_modules/@fortawesome/fontawesome-free";
@import "../../node_modules/@fortawesome/fontawesome-free/scss/fontawesome";
@import "../../node_modules/@fortawesome/fontawesome-free/scss/solid";
然后我尝试构建npm run build
并收到错误消息:
ERROR in ./src/scss/main.scss
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleNotFoundError: Module not found: Error: Can't resolve '../../node_modules/@fortawesome/fontawesome-free/fa-solid-900.eot' in 'C:\Users\gosto\Documents\project\src\scss'
答案 0 :(得分:0)
阅读软件包here
按照在文档中配置和导入软件包的方式