From 44bfaed10ed265823f7a7e46a4f6e2400fc26105 Mon Sep 17 00:00:00 2001 From: Dmitriy Lyner Date: Wed, 30 May 2018 13:32:54 -0600 Subject: [PATCH] this is more inline with webpack https://webpack.js.org/concepts/output/\#advanced --- index.js | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index 1d4f1c37..1ca8d4e8 100644 --- a/index.js +++ b/index.js @@ -96,25 +96,9 @@ function createLoaderRules(languages, features, workers, publicPath) { }), {}); const getWorkerPath = (workerPath) => { - const getBasePath = () => { - const bases = document.getElementsByTagName('base'); - let contextPath = '/'; - if (bases.length) { - contextPath = bases[0].getAttribute('context') || bases[0].href || '/'; - } - return contextPath; - }; - - const basePath = getBasePath(); - if (basePath[basePath.length - 1] !== '/') { - basePath = `${basePath}/`; + if(!publicPath && window.__webpack_public_path__) { + return `${window.__webpack_public_path__}/${workerPath}` } - if (workerPath[0] === '/') { - workerPath = workerPath.substr(1); - } - - const contextPath = basePath + workerPath; - return contextPath; }; const globals = {