forked from bryaneaton13/react-pull-to-refresh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.build.js
39 lines (37 loc) · 802 Bytes
/
webpack.build.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
var path = require('path');
var webpack = require('webpack');
var BASE_DIR = './'
var COMPONENT_NAME = 'react-pull-to-refresh';
var plugins = [];
function getPackageMain() {
return require(path.resolve('./package.json')).main;
}
if (process.env.MINIFY) {
plugins.push(
new webpack.optimize.UglifyJsPlugin()
);
COMPONENT_NAME += '.min';
}
module.exports = {
entry: path.resolve(getPackageMain()),
output: {
filename: path.resolve('./dist/' + COMPONENT_NAME + '.js'),
library: COMPONENT_NAME,
libraryTarget: 'umd'
},
externals: {
'react': 'React',
'react/addons': 'React',
'react-dom': 'ReactDOM'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel'
}
]
},
plugins: plugins
};