Use google closure compiler to minify code.

This commit is contained in:
Dillon Kearns 2019-08-22 05:39:32 -07:00
parent fac3099d7b
commit 7a68a8602d
2 changed files with 19 additions and 0 deletions

View File

@ -12,6 +12,7 @@ const AddFilesPlugin = require("./add-files-plugin.js");
const ImageminPlugin = require("imagemin-webpack-plugin").default;
const imageminMozjpeg = require("imagemin-mozjpeg");
const express = require("express");
const ClosurePlugin = require("closure-webpack-plugin");
module.exports = { start, run };
function start({ routes, debug, manifestConfig }) {
@ -264,6 +265,22 @@ function webpackOptions(production, routes, { debug, manifestConfig }) {
};
if (production) {
return merge(common, {
optimization: {
minimizer: [
new ClosurePlugin(
{ mode: "STANDARD" },
{
// compiler flags here
//
// for debuging help, try these:
//
// formatting: 'PRETTY_PRINT'
// debug: true,
// renaming: false
}
)
]
},
plugins: [
new PrerenderSPAPlugin({
// Required - The path to the webpack-outputted app to prerender.

View File

@ -21,6 +21,7 @@
"@babel/preset-env": "^7.5.5",
"babel-loader": "^8.0.6",
"chokidar": "^2.1.5",
"closure-webpack-plugin": "^2.0.1",
"copy-webpack-plugin": "^5.0.4",
"css-loader": "^3.2.0",
"elm": "^0.19.0-no-deps",
@ -30,6 +31,7 @@
"favicons-webpack-plugin": "^1.0.0",
"file-loader": "^4.2.0",
"glob": "^7.1.4",
"google-closure-compiler": "^20190819.0.0",
"gray-matter": "^4.0.2",
"html-webpack-plugin": "^3.2.0",
"imagemin-mozjpeg": "^8.0.0",