diff --git a/webpack.config.js b/webpack.config.js index 925ae42f4..3bb08cb3a 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -76,7 +76,7 @@ module.exports = { // lifetime for assets while still delivering changes quickly. oneOf: [ { - // Images referenced in CSS files + // Assets referenced in CSS files issuer: /\.(scss|css)$/, loader: 'file-loader', options: { @@ -92,11 +92,15 @@ module.exports = { }, }, { - // Images referenced in HTML and JS files + // Assets referenced in HTML and JS files loader: 'file-loader', options: { name: '[name].[hash:7].[ext]', outputPath: getImgOutputPath, + publicPath: function(url, resourcePath) { + const outputPath = getImgOutputPath(url, resourcePath); + return toPublicPath(outputPath); + }, }, }, ],