-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
93 lines (76 loc) · 2.09 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
90
91
92
93
require('es6-promise').polyfill()
const DashboardPlugin = require('webpack-dashboard/plugin')
var webpack = require('webpack')
var path = require('path')
var resolve = path.resolve
var config = {
cache: true,
devtool: 'source-map',
entry: 'index.js',
output: {
filename: 'bundle.js',
publicPath: '/assets/'
},
module: {
loaders: [
{
test: /\.js?$/,
loader: 'babel',
include: [
resolve(__dirname, 'index'),
resolve(__dirname, 'src'),
resolve(__dirname, 'lib'),
resolve(__dirname, 'tests'),
resolve(__dirname, 'node_modules/qux'),
resolve(__dirname, 'node_modules/dom-util'),
resolve(__dirname, 'node_modules/sentry'),
resolve(__dirname, 'node_modules/timer2'),
resolve(__dirname, 'node_modules/trax'),
resolve(__dirname, 'node_modules/stateful-router')
],
query: {
presets: ['es2015', 'react'],
plugins: ["transform-object-rest-spread"]
}
},
{
test: /\.css$/,
loaders: ['style', 'css']
},
{
test: /\.less$/,
loaders: ['style', 'css', 'less']
}
]
},
resolve: {
root: resolve(__dirname),
extensions: ['', '.js'],
alias: {
'loopda': resolve(__dirname),
}
},
plugins: [
new webpack.DefinePlugin({'process.env.NODE_ENV': '"development"'}),
new DashboardPlugin(),
]
}
if (process.env.NODE_ENV === 'production') {
Object.assign(config, {
cache: undefined,
devtool: undefined,
output: {
path: 'dist',
filename: 'loopda.min.js'
},
plugins: [
new webpack.DefinePlugin({'process.env.NODE_ENV': '"production"'}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.AggressiveMergingPlugin(),
new webpack.optimize.UglifyJsPlugin()
],
})
config.resolve.alias['react$'] = resolve(__dirname, 'node_modules/react/dist/react.min.js')
config.resolve.alias['react-dom$'] = resolve(__dirname, 'node_modules/react-dom/dist/react-dom.min.js')
}
module.exports = config