-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
45 lines (39 loc) · 1.5 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
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const ES3HarmonyPlugin = require('./build/ES3HarmonyPlugin');
module.exports = minimize => ({
mode : 'production',
target : ['web', 'es5'],
output : {
path : path.resolve(__dirname, 'dist'),
libraryTarget : 'umd',
globalObject : 'typeof window !== \'undefined\' ? window : this',
},
module : {
rules : [{
test : /\..?js$/,
use : {
loader : 'babel-loader',
options : {
presets : [
['@babel/env', {
forceAllTransforms : true,
loose : true,
modules : false, // ES6 modules should be processed only by webpack
// see https://github.com/babel/babel/issues/1087#issuecomment-373375175, naming anonymous functions is problematic
exclude : ['@babel/plugin-transform-function-name'],
}],
],
},
},
}],
},
entry : {
[`idea${minimize ? '.min' : ''}`] : './lib/index',
[`idea.all${minimize ? '.min' : ''}`] : ['./lib/polyfill', './lib/index'],
},
optimization : minimize ? {
minimizer : [new TerserPlugin({terserOptions : {ie8 : true}})],
} : {minimize : false},
plugins : [new ES3HarmonyPlugin()],
});