找不到Angular materialize字体

时间:2017-09-21 10:21:45

标签: angular typescript webpack angular-cli materialize

我尝试整合物化,但是当我尝试添加

"./node_modules/materialize-css/dist/js/materialize.js"

"./node_modules/materialize-css/sass/materialize.scss",

到webpack.config.json

我在构建时遇到此错误(我得到多个):

ERROR in ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./~/materialize-css/sass/materialize.scss
Module not found: Error: Can't resolve '../fonts/roboto/Roboto-Thin.woff2' in 'C:\Users\Administrateur\Documents\dev\git\front-ptc-angular\node_modules\materialize-css\sass'
 @ ./~/css-loader?{"sourceMap":false,"importLoaders":1}!./~/postcss-loader?{"ident":"postcss"}!./~/sass-loader/lib/loader.js?{"sourceMap":false,"precision":8,"includePaths":[]}!./~/materialize-css/sass/materialize.scss 6:77358-77402
 @ ./~/materialize-css/sass/materialize.scss
 @ multi ./~/materialize-css/sass/materialize.scss ./src/assets/scss/main.scss

有什么想法吗?

编辑:

我通过npm

添加了angular2-materialize和materialize-css

然后将两行添加到我的webpack配置

2 个答案:

答案 0 :(得分:0)

我使用实体化 bower 并且它给了我同样的问题,我通过将文件夹/ fonts / roboto复制到css和js的级别来解决它具体化的文件夹是。

答案 1 :(得分:0)

如果使用angular2实体化,则必须检查是否使用的是实体化版本0.100.2,因为该版本是唯一兼容的