Webpack: Must i specify the domain in publicPath for url() directive to work in CSS?

后端 未结 1 1079
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-20 06:24

My problem is that if I don\'t specify the complete domain in output.publicPath config option; then the url don\'t load properly (at least fonts).

My webpack config:

1条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-20 06:42

    Found it. Thanks to @diunarlist on webpack's gitter.

    It's because i was using sourceMap with style-loader. Check https://github.com/webpack/style-loader/issues/55

    With source-maps, style loader uses a Blob, so it requires absolute urls to work.

    Without source-maps it uses an inline style tag, so there is no problem.

    0 讨论(0)
提交回复
热议问题