summaryrefslogtreecommitdiffstats
path: root/web_src/js/publicpath.js
blob: 392c03e7003c2c286871802fced9350776272484 (plain)
1
2
3
4
5
6
7
8
9
10
11
// This sets up webpack's chunk loading to load resources from the 'public'
// directory. This file must be imported before any lazy-loading is being attempted.

if (document.currentScript && document.currentScript.src) {
  const url = new URL(document.currentScript.src);
  __webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/');
} else {
  // compat: IE11
  const script = document.querySelector('script[src*="/index.js"]');
  __webpack_public_path__ = script.getAttribute('src').replace(/\/[^/]*?\/[^/]*?$/, '/');
}