V
V
Vladislav2018-02-22 21:45:04
css
Vladislav, 2018-02-22 21:45:04

Webpack url, file-loader?

The link does not generate correctly, how to fix it?

test: /\.(ttf|eot|woff(2)?)$/,
loader: "file-loader?name=[md5:hash:base64:12].[ext]&&publicPath=../../"

It's in the SCSS file...
@font-face {
  font-family: PTSans;
  font-weight: 400;
  src: local("PT Sans"), url("~fonts/PTSans.eot?#iefix") format("embedded-opentype"), url("~fonts/PTSans.woff") format("woff"), url("~fonts/PTSans.ttf") format("truetype");
}

At the output I get this
@font-face {
  font-family: PTSans;
  font-weight: 400;
  src: local("PT Sans"), url(..\..\t3ZDiSmOxdUZ.eot?#iefix) format("embedded-opentype"), url(..\..\1UkE3C9ceFy4.woff) format("woff"), url(..\..\1eoudhJt15yQ.ttf) format("truetype");
}

In principle, the path is specified correctly, and such files are created, but the problem is that Google Chrome writes an error that the file was not found. But if you change "..\..\" in the css itself to "../../" then everything works fine, how can I fix it differently?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question