diff options
Diffstat (limited to 'web_src/js/publicPath.js')
-rw-r--r-- | web_src/js/publicPath.js | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/web_src/js/publicPath.js b/web_src/js/publicPath.js index 5d277e442a..120740d708 100644 --- a/web_src/js/publicPath.js +++ b/web_src/js/publicPath.js @@ -1,12 +1,11 @@ -/* This sets up webpack's chunk loading to load resources from the same - directory where it loaded index.js from. This file must be imported - before any lazy-loading is being attempted. */ +/* 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(/\/[^/]*$/, '')}/`; + __webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/'); } else { // compat: IE11 const script = document.querySelector('script[src*="/index.js"]'); - __webpack_public_path__ = `${script.getAttribute('src').replace(/\/[^/]*$/, '')}/`; + __webpack_public_path__ = script.getAttribute('src').replace(/\/[^/]*?\/[^/]*?$/, '/'); } |