Limit to one chunk
Considering that currently, there's no way to load the login page
without both the main json, and the 1 vendor chunk, chunking itself gets
us no extra performance, and makes it harder on the bmc, because we now
have to respond to two requests instead of one. These requests in
practice happen serially, so on high RTT connections, it can be a
negative on performance.
Simplify by changing the webpack settings to produce one chunk.
Tested: Webui loads properly. No errors on console when clicking
around.
Change-Id: Ida5bb748429137eb2414be1990168affe1d001af
Signed-off-by: Ed Tanous <ed@tanous.net>
diff --git a/vue.config.js b/vue.config.js
index 769f5c9..bd22674 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,4 +1,6 @@
const CompressionPlugin = require('compression-webpack-plugin');
+const webpack = require('webpack');
+const LimitChunkCountPlugin = webpack.optimize.LimitChunkCountPlugin;
module.exports = {
css: {
@@ -61,6 +63,16 @@
.loader('vue-svg-inline-loader');
},
configureWebpack: (config) => {
+ config.plugins.push(
+ new LimitChunkCountPlugin({
+ maxChunks: 1,
+ }),
+ );
+ config.optimization.splitChunks = {
+ cacheGroups: {
+ default: false,
+ },
+ };
const crypto = require('crypto');
const crypto_orig_createHash = crypto.createHash;
crypto.createHash = (algorithm) =>
@@ -97,6 +109,14 @@
}),
);
}
+
+ config.performance = {
+ hints: 'warning',
+ maxEntrypointSize: 512000,
+ maxAssetSize: 512000,
+ };
+
+ config.optimization.runtimeChunk = false;
},
pluginOptions: {
i18n: {