forked from react-bootstrap/react-router-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.babel.js
51 lines (44 loc) · 1.03 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
49
50
51
import webpack from 'webpack';
import yargs from 'yargs';
const { optimizeMinimize } = yargs.alias('p', 'optimize-minimize').argv;
const nodeEnv = optimizeMinimize ? 'production' : 'development';
export default {
entry: {
ReactRouterBootstrap: './src/index.js',
},
output: {
path: './lib',
filename: optimizeMinimize ? '[name].min.js' : '[name].js',
library: 'ReactRouterBootstrap',
libraryTarget: 'umd',
},
module: {
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /node_modules/ },
],
},
externals: [
{
react: {
root: 'React',
commonjs2: 'react',
commonjs: 'react',
amd: 'react',
},
},
{
'react-router': {
root: 'ReactRouter',
commonjs2: 'react-router',
commonjs: 'react-router',
amd: 'react-router',
},
},
],
plugins: [
new webpack.DefinePlugin({
'process.env': { NODE_ENV: JSON.stringify(nodeEnv) },
}),
],
devtool: optimizeMinimize ? 'source-map' : null,
};