Add compression and remove incompatible plugins
- Add gzip file compression
- Prefetch and preload plugins that add web loading primitives that are
not compatible with our server settings
- Move port to run dev from script flag to vue config file
- Remove sourcemap files from production build
Signed-off-by: Derick Montague <derick.montague@ibm.com>
Change-Id: I8df6ef7a73ad687dc2c7f5db810a221668a1dd01
diff --git a/vue.config.js b/vue.config.js
index 881c624..4b7c292 100644
--- a/vue.config.js
+++ b/vue.config.js
@@ -1,3 +1,5 @@
+const CompressionPlugin = require("compression-webpack-plugin");
+
module.exports = {
devServer: {
proxy: {
@@ -14,6 +16,23 @@
}
}
}
+ },
+ port: 8000
+ },
+ productionSourceMap: false,
+ configureWebpack: config => {
+ if (process.env.NODE_ENV === "production") {
+ config.plugins.push(
+ new CompressionPlugin({
+ deleteOriginalAssets: true
+ })
+ );
+ }
+ },
+ chainWebpack: config => {
+ if (process.env.NODE_ENV === "production") {
+ config.plugins.delete("prefetch");
+ config.plugins.delete("preload");
}
}
};