forked from gyliu513/dcos-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.webpack.config.js
89 lines (85 loc) · 1.85 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
var config = require('./.build.config');
var path = require('path');
var webpack = require('webpack');
var webpackDevtool = '#source-map';
var webpackWatch = false;
if (process.env.NODE_ENV === 'development') {
// eval-source-map is the same thing as source-map,
// except with caching. Don't use in production.
webpackDevtool = '#eval-source-map';
webpackWatch = true;
}
var vendors = [
'classnames',
'cookie',
'd3',
'deep-equal',
'flux',
'less-color-lighten',
'md5',
'mesosphere-shared-reactjs',
'moment',
'query-string',
'react',
'react-addons-css-transition-group',
'react-addons-test-utils',
'react-dom',
'react-gemini-scrollbar',
'react-redux',
'react-router',
'reactjs-components',
'reactjs-mixin',
'redux',
'underscore'
];
/**
* Build into 3 chunks to make use of parallel download.
*/
module.exports = {
devtool: webpackDevtool,
entry: {
index: [config.files.srcJS],
vendor: vendors
},
output: {
path: config.dirs.dist,
filename: '[name].js'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.js', Infinity)
],
module: {
loaders: [{
exclude: /node_modules/,
loader: 'babel-loader',
query: {
cacheDirectory: true
},
test: /\.js$/
},
{ test: /\.json$/, loader: 'json-loader' }],
preLoaders: [
{
test: /\.(js)$/,
loader: "eslint-loader",
exclude: /node_modules/
},
{
test: /\.js$/,
loader: 'source-map-loader',
exclude: /node_modules/
}],
postLoaders: [{
loader: 'transform/cacheable?envify'
}]
},
resolve: {
root: path.resolve(__dirname),
extensions: ['', '.js'],
alias: {
PluginSDK: 'src/js/plugin-bridge/PluginSDK',
PluginTestUtils: 'src/js/plugin-bridge/PluginTestUtils'
}
},
watch: webpackWatch
};