-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.umd.js
35 lines (33 loc) · 924 Bytes
/
webpack.umd.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
const bundle = require('./package.json');
const { merge } = require('webpack-merge');
const TerserPlugin = require('terser-webpack-plugin');
// build preamble
const preamble = `/*!\n ${bundle.name} – ${bundle.description}\n ${bundle.author.name} ${bundle.author.github} ${new Date().getFullYear()} ${bundle.license}\n ${bundle.version}\n*/`;
module.exports = (argv) => merge(require('./webpack.common.js')(argv), {
mode: 'production',
watch: false,
entry: './src/mojs.babel.js',
output: {
filename: 'mo.umd.js',
library: {
name: 'mojs',
type: 'umd',
export: 'default',
umdNamedDefine: true,
},
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
output: {
comments: false,
preamble: preamble,
},
toplevel: true,
},
}),
],
},
});