Fixed publicPath issue#19546
Conversation
alexander-akait
left a comment
There was a problem hiding this comment.
Please add a test case
3ce5bc1 to
e1f883b
Compare
|
I've added a failing test case. I tried to fix this, but that causes the other tests to fail. I'm not certain, but I think that is because the existing tests are not correct. This new test fails with the error output: {
path: path.resolve(testPath, "./bundle14"),
module: true,
publicPath: "/bundle14/",
filename: "initial/bundle14.mjs",
chunkFilename: "async/[id].bundle14.mjs"
}It should look for |
e1f883b to
d4ec7a9
Compare
|
I'm not able to understand how these tests verify the paths, but looking at the generated files it looks incorrect. For example for bundle11, which has this config: output: {
path: path.resolve(testPath, "./bundle11"),
module: true,
publicPath: "https://example.com/public/path/",
filename: "initial/bundle11.mjs",
chunkFilename: "async/[id].bundle11.mjs"
},The generated code contains: __webpack_require__.u = (chunkId) => {
// return url for filenames based on template
return "async/" + chunkId + ".bundle11.mjs";
};
__webpack_require__.p = "https://example.com/public/path/";
var promise = import(__webpack_require__.p + "../" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {
if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;
throw e;
});The result is The same is true for other tests, for example for bundle6, which has this config: {
devtool: false,
target: "web",
output: {
module: true,
publicPath: "",
filename: "initial/bundle6.mjs",
chunkFilename: "async/[id].bundle6.mjs"
},
experiments: {
outputModule: true
}
}It produces the following (summarized) __webpack_require__.u = (chunkId) => {
// return url for filenames based on template
return "async/" + chunkId + ".bundle6.mjs";
};
__webpack_require__.p = "";
var promise = import(__webpack_require__.p + "../" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {
if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;
throw e;
});The result is |
|
Yes, tests are not good, I am WIP on this |
|
Ignore failed tests, they will fixed in other PR, because it is not related to this job |
CodSpeed Performance ReportMerging #19546 will degrade performances by 80.74%Comparing Summary
Benchmarks breakdown
|
This fixes an issue for esm modules where they incorrectly used publicPath to locate the module. See #19495 (comment) and #19432 (comment). It was introduced in #19434
fixes #19547