forked from catamphetamine/libphonenumber-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
48 lines (45 loc) · 1.08 KB
/
webpack.config.babel.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
import path from 'path'
let inputFilePath
let outputFileName
switch (process.env.LIBPHONENUMBER_FLAVOR) {
case 'min':
inputFilePath = 'min/index'
outputFileName = 'libphonenumber-min'
break
case 'max':
inputFilePath = 'max/index'
outputFileName = 'libphonenumber-max'
break
case 'mobile':
inputFilePath = 'mobile/index'
outputFileName = 'libphonenumber-mobile'
break
// Legacy bundle (legacy default export).
default:
inputFilePath = 'index.es6'
outputFileName = 'libphonenumber-js.min'
break
}
export default {
entry: path.join(__dirname, `${inputFilePath}.js`),
devtool: 'source-map',
output: {
path : path.join(__dirname, 'bundle'),
filename : `${outputFileName}.js`,
library : 'libphonenumber',
libraryTarget : 'umd',
umdNamedDefine : true
},
module: {
rules: [{
test : /(\.js)$/,
loader : 'babel-loader',
exclude : /node_modules/
}]
},
externals: {
// Use external version of React
"react" : "React",
"react-dom" : "ReactDOM"
}
}