Webpack “OTS parsing error” loading fonts

前端 未结 13 1053
[愿得一人]
[愿得一人] 2020-11-28 20:51

My webpack config specifies that fonts should be loaded using url-loader, and when I try to view the page using Chrome I get the following error:



        
13条回答
  •  有刺的猬
    2020-11-28 21:18

    As with @user3006381 above, my issue was not just relative URLs but that webpack was placing the files as if they were javascript files. Their contents were all basically:

    module.exports = __webpack_public_path__ + "7410dd7fd1616d9a61625679285ff5d4.eot";
    

    in the fonts directory instead of the real fonts and the font files were in the output folder under hash codes. To fix this, I had to change the test on my url-loader (in my case my image processor) to not load the fonts folder. I still had to set output.publicPath in webpack.config.js as @will-madden notes in his excellent answer.

提交回复
热议问题