1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-24 20:55:49 +00:00

Generalize minifier (#2577)

This commit is contained in:
Paulus Schoutsen
2019-01-26 18:55:32 -08:00
committed by GitHub
parent 1ffeace8f9
commit 5a6d537d43
6 changed files with 53 additions and 48 deletions

View File

@@ -1,9 +1,9 @@
const path = require("path");
const webpack = require("webpack");
const UglifyJsPlugin = require("uglifyjs-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
const WorkboxPlugin = require("workbox-webpack-plugin");
const { babelLoaderConfig } = require("../config/babel.js");
const { minimizer } = require("../config/babel.js");
const isProd = process.env.NODE_ENV === "production";
const chunkFilename = isProd ? "chunk.[chunkhash].js" : "[name].chunk.js";
@@ -39,6 +39,9 @@ module.exports = {
},
],
},
optimization: {
minimizer,
},
plugins: [
new webpack.DefinePlugin({
__DEV__: false,
@@ -69,19 +72,10 @@ module.exports = {
},
]),
isProd &&
new UglifyJsPlugin({
extractComments: true,
sourceMap: true,
uglifyOptions: {
// Disabling because it broke output
mangle: false,
},
new WorkboxPlugin.GenerateSW({
swDest: "service_worker_es5.js",
importWorkboxFrom: "local",
}),
// isProd &&
new WorkboxPlugin.GenerateSW({
swDest: "service_worker_es5.js",
importWorkboxFrom: "local",
}),
].filter(Boolean),
resolve: {
extensions: [".ts", ".js", ".json"],