Webpack 4字体问题

时间:2019-05-01 00:25:17

标签: webpack-4

我极力试图使字体可见,同时将所有字体与webpack捆绑在一起,但没有成功。我遵循了webpack 4文档,但不适用于字体。其他所有工作似乎都可以完美地找到,只是那个字体。知道为什么吗?

webpack cfg

{
 test: /\.(woff|woff2|eot|ttf|otf)$/,
 use: ['file-loader']
}

scss

@font-face {
    font-family: 'SourceSans';
    src: url('/SourceSans.otf') format('otf')  (/font is the only path that dosent give me an error while bundling)
}

js import sass

import './sass/main.scss;

1 个答案:

答案 0 :(得分:0)

更新:问题解决了,那里的scss和url(...)解决了它> https://github.com/bholloway/resolve-url-loader/blob/master/packages/resolve-url-loader/README.md