forked from vintharas/js13k-spaceshooter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
58 lines (55 loc) · 1.43 KB
/
webpack.prod.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const merge = require("webpack-merge");
const common = require("./webpack.common.js");
const ZopfliPlugin = require("zopfli-webpack-plugin");
// # Closure compiler
// This is the official plugin for webpack but it doesn't work with webpack 4
//const ClosurePlugin = require("closure-webpack-plugin");
// This is another package by Google
/*
const fs = require("fs");
const ClosureCompiler = require("google-closure-compiler-js").webpack;
const externs = fs.readFileSync("./externs.js", "utf8");
*/
module.exports = merge(common, {
// Using the production setting
// enables UglifyJS with tree shaking
mode: "production",
module: {
rules: []
},
plugins: [
/* this doesn't work with webpack 4 haha
new ClosurePlugin(
{ mode: "STANDARD" },
{
// compiler flags here
//
// for debuging help, try these:
//
// formatting: 'PRETTY_PRINT'
// debug: true
}
),
*/
/*
new ClosureCompiler({
options: {
languageIn: "ES6",
languageOut: "ES6",
compilationLevel: "ADVANCED",
//compilationLevel: "SIMPLE",
warningLevel: "VERBOSE",
//externs: ["./externs.js"]
externs: [{ src: externs }]
}
})
*/
// Will use advzip via commandline
new ZopfliPlugin({
asset: "[path].gz[query]",
algorithm: "zopfli",
test: /\.(html|js)$/,
deleteOriginalAssets: false
})
]
});