-
Notifications
You must be signed in to change notification settings - Fork 158
/
webpack.config.babel.js
47 lines (41 loc) · 1 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
const path = require('path');
module.exports = (env, argv) => {
const mode = argv.mode || 'development';
const optimizationMinimize = argv.optimizationMinimize;
return {
mode,
entry: {
ReactRouterBootstrap: './src/index.js',
},
output: {
path: path.join(__dirname, 'lib'),
filename: optimizationMinimize ? '[name].min.js' : '[name].js',
library: 'ReactRouterBootstrap',
libraryTarget: 'umd',
},
module: {
rules: [
{ test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
],
},
externals: [
{
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
},
{
'react-router-dom': {
root: 'ReactRouterDOM',
commonjs2: 'react-router-dom',
commonjs: 'react-router-dom',
amd: 'react-router-dom',
},
},
],
devtool: optimizationMinimize ? 'source-map' : false,
};
};