我是NPM和Webpack的新手,正在努力实现最新的Font Awesome Pro(5.1.1)。
我遵循了instructions for installing through NPM,包括创建.npmrc文件,并通过NPM安装为npm install --save-dev @fortawesome/fontawesome-pro
我确定引用时会出错。我已经尝试了许多教程,但是在NPM中遇到以下错误;
ERROR in ./src/js/index.js
Module not found: Error: Can't resolve '@fortawesome/fontawesome-pro/falStar' in 'J:\Documents\Database\src\js'
@ ./src/js/index.js 15:15-62
@ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/js/index.js font-awesome/js/all.js
ERROR in multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/js/index.js font-awesome/js/all.js
Module not found: Error: Can't resolve 'font-awesome/js/all.js' in 'J:\Documents\Database'
@ multi (webpack)-dev-server/client?http://localhost:8080 babel-polyfill ./src/js/index.js font-awesome/js/all.js main[3]
我的index.js文件看起来像这样;
import fontawesome from "@fortawesome/fontawesome-pro";
import falStar from "@fortawesome/fontawesome-pro/falStar";
fontawesome.library.add(falStar);
fontawesome.dom.i2svg();
我毫不怀疑我在做一些愚蠢的事情,但是我对NPM和webpack还是很陌生,所以我可能看不到明显的东西。
非常感谢