-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathwebpack.config.js
More file actions
41 lines (39 loc) · 1013 Bytes
/
webpack.config.js
File metadata and controls
41 lines (39 loc) · 1013 Bytes
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
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
mode: "production",
entry: {
TermiWidget: './src/TermiWidget.js',
MLB: './src/MLB.js',
},
output: {
path:path.resolve(__dirname, "dist"),
},
experiments: {
topLevelAwait: true,
},
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
minify: (file, map, minimizerOptions) => {
let code = file[Object.keys(file)[0]];
const pattern = /\/\/ Variables used by Scriptable([^\0]*?)\/[\*]+\//;
const matches = code.match(pattern)
code = matches[0] + '\n' + code.replace(pattern, '');
return { map, code };
},
}),
],
},
// plugins: [
// new webpack.BannerPlugin({
// banner: (va) => {
// console.log(Object.keys(va.chunk));
// console.log(va.chunk.files)
// return 'hello world';
// }
// })
// ]
}