This repository has been archived by the owner on Aug 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
49 lines (48 loc) · 1.4 KB
/
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
'use strict';
let path = require('path');
let webpack = require('webpack');
let HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
loaders: {
babel: {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react'],
plugins: ['add-module-exports']
}
}
},
plugins: {
provide: (obj = {
React: 'react',
createFragment: 'react-addons-create-fragment',
ReactDOM: 'react-dom',
Redux: 'redux',
ReactRedux: 'react-redux'
}) => new webpack.ProvidePlugin(obj),
define: {
dev: new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('development')
}
}),
prod: new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
})
},
uglify: new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
wbpDev: (template = 'index.tpl.html', inject = 'head', name = 'index.html') => new HtmlWebpackPlugin({
template: template,
inject: inject,
filename: name
})
}
};