From 95d36c1f298082b16a1aaf9d0c4823134f04a4d5 Mon Sep 17 00:00:00 2001 From: "J. Ryan Stinnett" Date: Tue, 28 May 2019 14:31:20 +0100 Subject: [PATCH] Fix Twemoji loading on Windows dev machines This corrects our path handling on Windows development machines for paths referenced in JS and HTML files. Both images and fonts (like Twemoji) were afflicted (with Windows-style backslash path delimiters), but browsers seems to tolerate them in the `src` attribute of images, so we didn't notice that variant before. --- webpack.config.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/webpack.config.js b/webpack.config.js index 925ae42f..3bb08cb3 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); + }, }, }, ],