generated from wikimedia-gadgets/twinkle-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
46 lines (45 loc) · 1020 Bytes
/
webpack.prod.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
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const args = require('minimist')(process.argv.slice(2));
module.exports = {
mode: 'production',
entry: './src/twinkle.ts',
target: ['web', 'es5'],
module: {
rules: [
{
test: /\.ts$/,
loader: 'ts-loader',
options: {
transpileOnly: true,
},
},
],
},
resolve: {
extensions: ['.js', '.ts'],
},
plugins: [
// specify --excludeEnglishMessages to exclude English messages (about 20 kb) in build
// Do this ONLY if you are sure all messages have been translated into your local language,
// otherwise users will see message keys
new webpack.DefinePlugin({
EXCLUDE_ENGLISH_MESSAGES: Boolean(args.excludeEnglishMessages)
})
],
output: {
filename: 'twinkle.js',
path: path.resolve(__dirname, 'build'),
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: /@preserve/,
}),
],
},
performance: {
hints: false,
},
};