Webpack can not load font file: Unexpected Token

后端 未结 2 590
不知归路
不知归路 2020-12-16 08:55

I have a style.css file that makes use of a font file, and I\'m having trouble getting the font file loaded using Webpack. Here is my loader configuration:

2条回答
  •  不知归路
    2020-12-16 09:30

    The regex in your test expression has a small mistake. woff(2) means that it always looks for woff2 and just captures the 2 in a separate group. If you add a ? after it, webpack should be able to recognize woff as well:

    test   : /\.(ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
    loader : 'file-loader'
    

    Please let me know if this worked.

提交回复
热议问题