From 2f0c4322c23b1402b9a2a9ede402ca87a49377e8 Mon Sep 17 00:00:00 2001 From: gzzo Date: Mon, 22 Jul 2019 12:27:13 -0400 Subject: [PATCH] Don't use `path.join` when `publicPath` is a URL Fixes #67 --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index dcdc458..f580ed3 100644 --- a/index.js +++ b/index.js @@ -71,7 +71,12 @@ HtmlWebpackInlineSourcePlugin.prototype.resolveSourceMaps = function (compilatio var publicPath = out.publicPath || ''; // Prepend Webpack public URL path to source map relative path // Calling `slash` converts Windows backslashes to forward slashes - var mapUrlCorrected = slash(path.join(publicPath, mapPathRelative)); + var mapUrlCorrected; + if (publicPath.indexOf('http') === 0) { + mapUrlCorrected = publicPath + '/' + mapPathRelative + } else { + mapUrlCorrected = slash(path.join(publicPath, mapPathRelative)); + } // Regex: exact original sourcemap URL, possibly '*/' (for CSS), then EOF, ignoring whitespace var regex = new RegExp(escapeRegex(mapUrlOriginal) + '(\\s*(?:\\*/)?\\s*$)'); // Replace sourcemap URL and (if necessary) preserve closing '*/' and whitespace