-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
48 lines (43 loc) · 1.34 KB
/
webpack.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
// For info about this file refer to webpack and webpack-hot-middleware documentation
// Rather than having hard coded webpack.config.js for each environment, this
// file generates a webpack config for the environment passed to the getConfig method.
"use strict";
var webpack = require('webpack');
var path = require('path');
// import ExtractTextPlugin from 'extract-text-webpack-plugin';
var DEV = 'development';
var PROD = 'production';
var TEST = 'test';
var env = process.env.NODE_ENV;
var GLOBALS = {
'process.env.NODE_ENV': JSON.stringify(env),
__DEV__: env === DEV
};
var config = {
entry: './src/Union.js',
devtool: env === PROD ? 'source-map' : 'eval',
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules(?!\/rxjs))/,
loaders: ["babel-loader"],
}
]
},
output: {
filename: "union.js",
path: __dirname + "/lib",
libraryTarget: "commonjs2"
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin(GLOBALS), //Tells React to build in prod mode. https://facebook.github.io/react/downloads.html
new webpack.optimize.DedupePlugin()
// new webpack.optimize.UglifyJsPlugin()
],
devServer: {
port: 2020
}
};
module.exports = config;