vuejs-templates / webpack

A full-featured Webpack + vue-loader setup with hot reload, linting, testing & css extraction.
MIT License
9.71k stars 4.4k forks source link

Actually, you could overwrite `publicPath` in `ExtractTextPlugin` as you want. #1510

Closed YouziXR closed 4 years ago

YouziXR commented 4 years ago

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: '../../'})

Originally posted by @LucienLee in https://github.com/vuejs-templates/webpack/issues/166#issuecomment-262729584

YouziXR commented 4 years ago

sorry, my bad, i just did an incorrect operation