-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.prod.config.js
53 lines (45 loc) · 1.12 KB
/
webpack.prod.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
46
47
48
49
50
51
52
53
'use strict';
var path = require('path'),
webpack = require('webpack'),
nodeModulesPath = path.join(__dirname, 'node_modules');
var js_root = './lib/';
var js_dist = __dirname;
// 0 stands for development, 1 stands for production
// for development mode: NODE_ENV=0 webpack
// for production mode: NODE_ENV=1 webpack
var ENV = !!(+process.env.NODE_ENV || 0);
module.exports = [{
name: 'prod',
entry: {
"react-d3-brush": js_root + 'index.js',
},
output: {
libraryTarget: "var",
library: "ReactD3Brush",
path: js_dist,
filename: ENV ? '[name].min.js': '[name].js'
},
module: {
loaders: [
{
test: [/\.jsx$/, /\.js$/],
exclude: /node_modules/,
loaders: ["jsx-loader"],
},
{
test: /\.css$/,
loader: 'style-loader!css-loader'
}
],
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.jsx']
},
externals: {
//don't bundle the 'react' npm package with our bundle.js
//but get it from a global 'React' variable
'react': 'React',
'react-dom': 'ReactDOM',
'd3': 'd3'
}
}];