From ebb5943e687c9611331959ef680939d83b18789b Mon Sep 17 00:00:00 2001 From: IamDLY <1219642339@qq.com> Date: Sat, 14 Nov 2020 11:01:46 +0800 Subject: [PATCH] fix: check for http in baseUrl (#1594) --- plugins/plugin-webpack/plugin.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/plugin-webpack/plugin.js b/plugins/plugin-webpack/plugin.js index 57544da6f1..f588338de1 100644 --- a/plugins/plugin-webpack/plugin.js +++ b/plugins/plugin-webpack/plugin.js @@ -76,7 +76,9 @@ function emitHTMLFiles({doms, jsEntries, stats, baseUrl, buildDirectory, htmlMin for (const cssFile of cssFiles) { const linkEl = dom.window.document.createElement('link'); linkEl.setAttribute('rel', 'stylesheet'); - linkEl.href = path.posix.join(baseUrl, cssFile); + linkEl.href = url.parse(baseUrl).protocol + ? url.resolve(baseUrl, cssFile) + : path.posix.join(baseUrl, cssFile); head.append(linkEl); } originalScriptEl.remove();