aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js/publicpath.js
blob: bfc81b87658cfe925e295cbaad82b9121a1c723c (plain)
1
2
3
4
5
6
7
8
9
10
// 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 {AssetUrlPrefix} = window.config;

if (AssetUrlPrefix) {
  __webpack_public_path__ = AssetUrlPrefix.endsWith('/') ? AssetUrlPrefix : `${AssetUrlPrefix}/`;
} else {
  const url = new URL(document.currentScript.src);
  __webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/');
}