maasdi/react-assets-maven-plugin

build inline runtime chunk does not include in the public url in the script.

Ahammad-raj opened this issue · 0 comments

runtime-main.[chunk].js file has some references to other chunk files. Public url is not included in those chunk files. Refer the below function from runtime-main.[hash].js below files form the function should append the public url while these files are requested from server.

3.[hash].chunk.js
4.[hash].chunk.js
5.[hash].chunk.js

function (e) {
var t = [];
o[e] ? t.push(o[e]) : 0 !== o[e] && {3: 1, 4: 1}[e] && t.push(o[e] = new Promise((function (t, r) {
for (var n = "static/css/" + ({}[e] || e) + "." + {
3: "785fe4bc",
4: "8d63bff2",
5: "31d6cfe0"
}[e] + ".chunk.css", a = u.p + n, i = document.getElementsByTagName("link"), c = 0; c < i.length; c++) {
var l = (s = i[c]).getAttribute("data-href") || s.getAttribute("href");
if ("stylesheet" === s.rel && (l === n || l === a)) return t()
}
var f = document.getElementsByTagName("style");
for (c = 0; c < f.length; c++) {
var s;
if ((l = (s = f[c]).getAttribute("data-href")) === n || l === a) return t()
}
var d = document.createElement("link");
d.rel = "stylesheet", d.type = "text/css", d.onload = t, d.onerror = function (t) {
var n = t && t.target && t.target.src || a,
i = new Error("Loading CSS chunk " + e + " failed.\n(" + n + ")");
i.code = "CSS_CHUNK_LOAD_FAILED", i.request = n, delete o[e], d.parentNode.removeChild(d), r(i)
}, d.href = a, document.getElementsByTagName("head")[0].appendChild(d)
})).then((function () {
o[e] = 0
})));
var r = a[e];
if (0 !== r) if (r) t.push(r[2]); else {
var n = new Promise((function (t, n) {
r = a[e] = [t, n]
}));
t.push(r[2] = n);
var i, c = document.createElement("script");
c.charset = "utf-8", c.timeout = 120, u.nc && c.setAttribute("nonce", u.nc), c.src = function (e) {
return u.p + "static/js/" + ({}[e] || e) + "." + {
3: "d4761edb",
4: "35f903d0",
5: "fcd141c5"
}[e] + ".chunk.js"
}(e);
var l = new Error;
i = function (t) {
c.onerror = c.onload = null, clearTimeout(f);
var r = a[e];
if (0 !== r) {
if (r) {
var n = t && ("load" === t.type ? "missing" : t.type), o = t && t.target && t.target.src;
l.message = "Loading chunk " + e + " failed.\n(" + n + ": " + o + ")", l.name = "ChunkLoadError", l.type = n, l.request = o, r1
}
a[e] = void 0
}
};
var f = setTimeout((function () {
i({type: "timeout", target: c})
}), 12e4);
c.onerror = c.onload = i, document.head.appendChild(c)
}
return Promise.all(t)
}