加载Roboto字体时构建失败

时间:2017-10-17 19:23:24

标签: javascript reactjs webpack extracttextwebpackplugin roboto

在Material UI' getting started guide之后,我在我的存储库中安装了typeface-roboto,如下所示:

http://localhost:8080/login

Index.js是我的React应用程序的入口点:

npm install typeface-roboto

据该网站称,这应该可以解决问题。但是,运行时,webpack会向我抛出此错误:

import React from 'react'
import { render } from 'react-dom'

import 'typeface-roboto'

render(
    (
        <div>
            <h1>Hello world</h1>
        </div>
    ), document.getElementById('app')
)

webpack.config.js的模块部分:

ERROR in ./node_modules/typeface-roboto/index.css
Module build failed: TypeError: text.forEach is not a function
    at /Users/verhage/dev/my_app/node_modules/extract-text-webpack-plugin/dist/loader.js:135:14
    at compile (/Users/verhage/dev/my_app/node_modules/webpack/lib/Compiler.js:304:11)
    at applyPluginsAsync.err (/Users/verhage/dev/my_app/node_modules/webpack/lib/Compiler.js:514:14)
    at next (/Users/verhage/dev/my_app/node_modules/tapable/lib/Tapable.js:202:11)
    at Compiler.<anonymous> (/Users/verhage/dev/my_app/node_modules/extract-text-webpack-plugin/dist/loader.js:112:7)
    at next (/Users/verhage/dev/my_app/node_modules/tapable/lib/Tapable.js:204:14)

我发现了许多类似的相关问题,人们或多或少会随意提出解决方案&#39;在它,但实际上并没有修理任何东西或解释这里发生的事情。

二手版本:

  • webpack 3.7.1
  • extract-text-webpack-plugin 3.0.1
  • typeface-roboto 0.0.41
  • node 8.6.0

0 个答案:

没有答案