This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 122
/
webpack.prod.js
68 lines (66 loc) · 1.58 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
59
60
61
62
63
64
65
66
67
68
const webpack = require("webpack");
const path = require("path");
// Workbox
const WorkboxPlugin = require("workbox-webpack-plugin");
// Brotli
const BrotliPlugin = require("brotli-webpack-plugin");
// GZip
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
mode: "production",
module: {
rules: [
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "url-loader"
},
{
test: /\.(ttf|eot|svg)(\?v=[0-9]\.[0-9]\.[0-c9])?$/,
loader: "url-loader"
},
{
test: /\.js?$/,
loader: "babel-loader",
exclude: /node_modules/,
query: {
cacheDirectory: true
}
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
},
{
test: /\.(gif|png|jpe?g|svg)$/i,
use: [
"file-loader",
{
loader: "image-webpack-loader"
}
]
}
]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.ProvidePlugin({
fetch: "imports-loader?this=>global!exports?global.fetch!whatwg-fetch"
}),
new webpack.optimize.AggressiveMergingPlugin(),
new BrotliPlugin(),
new CompressionPlugin(),
new WorkboxPlugin.GenerateSW()
],
context: path.join(__dirname, "assets"),
entry: {
app: ["./js/app"],
join: ["./js/join"],
rsvp: ["./js/rsvp"],
partner: ["./js/partner"],
location: ["./js/location"]
},
output: {
filename: path.join("assets", "js", "[name].js"),
path: path.join(__dirname, "dist")
}
};