Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
fix(Build): Make static asset paths relative so they work on CDNs
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-ketch committed Aug 5, 2020
1 parent a253690 commit aade93a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,16 @@ module.exports = (env = {}, { mode }) => {
use: [
{
loader: MiniCssExtractPlugin.loader,
options: { hmr: isDevelopment },
options: {
hmr: isDevelopment,
publicPath: (resourcePath, context) => {
// Make asset paths relative
// @see https://github.com/webpack-contrib/mini-css-extract-plugin#the-publicpath-option-as-function
return (
path.relative(path.dirname(resourcePath), context) + '/'
)
},
},
},
{
loader: 'css-loader',
Expand Down

0 comments on commit aade93a

Please sign in to comment.