-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.prod.ts
53 lines (50 loc) · 1.22 KB
/
webpack.prod.ts
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
import path from "path";
import { WebpackManifestPlugin } from "webpack-manifest-plugin";
import UglifyJsPlugin from "uglifyjs-webpack-plugin";
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
import webpack from "webpack";
import merge from "webpack-merge";
// @ts-ignore
import common from "./webpack.common";
const config = {
mode: "production",
entry: ["./src/index"],
output: {
filename: "[name].[hash].js",
publicPath: "/",
path: path.resolve("./dist"),
},
optimization: {
splitChunks: {
// include all types of chunks
chunks: "all",
},
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
},
devtool: false,
plugins: [
new webpack.EnvironmentPlugin({
API: "https://agni-web-os.herokuapp.com",
}),
new webpack.ContextReplacementPlugin(/moment[/\\]locale$/, /en/),
new UglifyJsPlugin({
sourceMap: true,
include: /\.min\.js$/,
uglifyOptions: {
ecma: 5,
},
}),
new WebpackManifestPlugin(),
new BundleAnalyzerPlugin({
analyzerMode: "static",
openAnalyzer: true,
}),
],
externals: {
react: "React",
"react-dom": "ReactDOM",
},
};
module.exports = merge(common, config);