Actually, you could overwrite publicPath in ExtractTextPlugin as you want.
This template extracts the styles when building and use the same public path as config. Hence, all path would default start like /static/.... In the original case, you got font face path as rootpath/static/css/static/fonts, because you might change the assetsPublicPath to relative path ./. In the stylesheet, your font face would like ./static/fonts/..., but css url would refer from the position of stylesheet. Then, you got this wrong one rootpath/static/css/static/fonts.
In this case, you could just add public path here.
If you still stick on webpack1, that would be like return ExtractTextPlugin.extract('vue-style-loader', sourceLoader, {publicPath: '../../'})
Actually, you could overwrite
publicPath
inExtractTextPlugin
as you want. This template extracts the styles when building and use the same public path as config. Hence, all path would default start like/static/...
. In the original case, you got font face path asrootpath/static/css/static/fonts
, because you might change theassetsPublicPath
to relative path./
. In the stylesheet, your font face would like./static/fonts/...
, but css url would refer from the position of stylesheet. Then, you got this wrong onerootpath/static/css/static/fonts
.In this case, you could just add public path here. If you still stick on webpack1, that would be like
return ExtractTextPlugin.extract('vue-style-loader', sourceLoader, {publicPath: '../../'})
Originally posted by @LucienLee in https://github.com/vuejs-templates/webpack/issues/166#issuecomment-262729584