mirror of
https://github.com/go-gitea/gitea
synced 2024-11-01 07:44:25 +00:00
b797b76abd
Previously, we had only set __webpack_public_path__ to a path which caused webpack chunks to be loaded from the current origin which is incorrect when STATIC_URL_PREFIX points to another origin. This should fix the issue curretnly seen on gitea.com. Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv>
11 lines
442 B
JavaScript
11 lines
442 B
JavaScript
// 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;
|
|
|
|
if (StaticUrlPrefix) {
|
|
__webpack_public_path__ = StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`;
|
|
} else {
|
|
const url = new URL(document.currentScript.src);
|
|
__webpack_public_path__ = url.pathname.replace(/\/[^/]*?\/[^/]*?$/, '/');
|
|
}
|