我拼命想让我的字体可见,同时用webpack捆绑所有字体,但没有成功。我关注了webpack 4 doc,但它不适用于字体。所有其他的声明似乎都能完美地找到,就像那个字体一样。知道为什么吗?
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;
更新:问题解决了scss和url的问题(...)这解决了它> https://github.com/bholloway/resolve-url-loader/blob/master/packages/resolve-url-loader/README.md