This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
103 lines (100 loc) · 2.27 KB
/
webpack.config.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
const path = require("path");
const webpack = require("webpack");
const nodeExternals = require("webpack-node-externals");
const TerserPlugin = require("terser-webpack-plugin");
// const BundleAnalyzerPlugin = require("webpack-bundle-analyzer").BundleAnalyzerPlugin;
module.exports = {
mode: "development", // production
entry: {
"wikidata-api": "./index.ts"
},
devtool: "inline-source-map",
module: {
rules: [
{
test: /\.ts?$/,
enforce: "pre",
use: [
{
loader: "tslint-loader",
options: {
typeCheck: false,
fix: true
}
}
],
exclude: /node_modules/
},
{
test: /\.ts?$/,
use: [
{
loader: "ts-loader",
options: {
/* Loader options go here */
}
}
],
exclude: /node_modules/
}
]
},
optimization: {
minimizer: [
new TerserPlugin({
parallel: true,
terserOptions: {
compress: {
ecma: 6,
keep_fargs: false,
module: true,
toplevel: true,
warnings: true,
unsafe_methods: true,
unsafe_undefined: true
},
output: {
beautify: false,
comments: false
// output options
},
warnings: false,
mangle: {
module: true,
toplevel: true,
properties: {
regex: /_$/
}
},
toplevel: true,
module: true,
ie8: false,
keep_classnames: false,
keep_fnames: false,
safari10: false
}
})
]
},
resolve: {
extensions: ["json", ".ts", ".js"]
},
plugins: [
new webpack.DefinePlugin({
COMPILED_DATE: JSON.stringify(+new Date())
})
// new BundleAnalyzerPlugin({
// analyzerMode: "static",
// reportFilename: "webpack/report.html",
// generateStatsFile: true,
// statsFilename: "webpack/stat.json",
// openAnalyzer: false
// })
],
output: {
path: path.join(__dirname, "dist"),
filename: "[name].js"
},
target: "node",
externals: [nodeExternals()]
};