2020-05-22 13:18:44 -06:00
|
|
|
// This sets up the URL prefix used in webpack's chunk loading.
|
|
|
|
// This file must be imported before any lazy-loading is being attempted.
|
|
|
|
const {StaticUrlPrefix} = window.config;
|
2019-11-17 14:39:06 -07:00
|
|
|
|
2020-05-22 13:18:44 -06:00
|
|
|
if (StaticUrlPrefix) {
|
|
|
|
__webpack_public_path__ = StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`;
|
|
|
|
} else if (document.currentScript && document.currentScript.src) {
|
2019-11-17 14:39:06 -07:00
|
|
|
const url = new URL(document.currentScript.src);
|
2020-01-25 01:41:34 -07:00
|
|
|
__webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/');
|
2019-11-17 14:39:06 -07:00
|
|
|
} else {
|
|
|
|
// compat: IE11
|
|
|
|
const script = document.querySelector('script[src*="/index.js"]');
|
2020-01-25 01:41:34 -07:00
|
|
|
__webpack_public_path__ = script.getAttribute('src').replace(/\/[^/]*?\/[^/]*?$/, '/');
|
2019-11-17 14:39:06 -07:00
|
|
|
}
|