-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
50 lines (48 loc) · 1.41 KB
/
webpack.config.js
File metadata and controls
50 lines (48 loc) · 1.41 KB
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
/* eslint-disable */
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
// Set to 'server' to open interactive report, 'static' to generate HTML, or null to disable
const analyzeBundle = process.env.ANALYZE === 'true';
module.exports = {
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx"]
},
plugins: [
// Bundle analyzer (enable with ANALYZE=true)
...(analyzeBundle ? [new BundleAnalyzerPlugin({
analyzerMode: 'static',
openAnalyzer: false,
reportFilename: 'bundle-report.html'
})] : [])
],
mode: "production",
optimization: {
minimize: true,
usedExports: true,
sideEffects: false
},
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/
},
{
test: /\.less$/,
use: [
{
loader: "style-loader", // CommonJs -> style nodes
},
{
loader: "css-loader", // CSS -> CommonJS
},
{
loader: "less-loader", // Less -> CSS
}
],
exclude: /node_modules/
}
]
}
};