DEV: Introduce webpack-retry-chunk-load-plugin (#28960)

In our test suite, we sometimes see ChunkLoadErrors. This plugin should cause those failed requests to be retried seamlessly. It'll also help clients with flaky internet connections in production.
This commit is contained in:
David Taylor 2024-09-18 15:50:24 +01:00 committed by GitHub
parent c6c4e09ba3
commit aa9c59a24b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 183 additions and 830 deletions

View File

@ -13,6 +13,7 @@ const DeprecationSilencer = require("deprecation-silencer");
const { compatBuild } = require("@embroider/compat");
const { Webpack } = require("@embroider/webpack");
const { StatsWriterPlugin } = require("webpack-stats-plugin");
const { RetryChunkLoadPlugin } = require("webpack-retry-chunk-load-plugin");
const withSideWatch = require("./lib/with-side-watch");
const RawHandlebarsCompiler = require("discourse-hbr/raw-handlebars-compiler");
const crypto = require("crypto");
@ -223,6 +224,11 @@ module.exports = function (defaults) {
return JSON.stringify(output, null, 2);
},
}),
new RetryChunkLoadPlugin({
retryDelay: 200,
maxRetries: 2,
chunks: ["assets/discourse.js"],
}),
],
},
},

View File

@ -125,6 +125,7 @@
"util": "^0.12.5",
"virtual-dom": "^2.1.1",
"webpack": "^5.94.0",
"webpack-retry-chunk-load-plugin": "^3.1.1",
"webpack-stats-plugin": "^1.1.3",
"xss": "^1.0.15"
},

File diff suppressed because it is too large Load Diff