This commit is contained in:
Dmitriy Lyner 2018-05-30 13:32:54 -06:00
parent f1ea23c229
commit 44bfaed10e

View file

@ -96,25 +96,9 @@ function createLoaderRules(languages, features, workers, publicPath) {
}), {}); }), {});
const getWorkerPath = (workerPath) => { const getWorkerPath = (workerPath) => {
const getBasePath = () => { if(!publicPath && window.__webpack_public_path__) {
const bases = document.getElementsByTagName('base'); return `${window.__webpack_public_path__}/${workerPath}`
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 (workerPath[0] === '/') {
workerPath = workerPath.substr(1);
}
const contextPath = basePath + workerPath;
return contextPath;
}; };
const globals = { const globals = {