-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.prod.babel.js
More file actions
92 lines (90 loc) · 2.19 KB
/
webpack.config.prod.babel.js
File metadata and controls
92 lines (90 loc) · 2.19 KB
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
import path from 'path'
import webpack from 'webpack'
import paths from './paths'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
export default {
devtool: 'hidden-source-map',
entry: {
'index': [path.join(paths.src, 'index.js')]
},
output: {
path: paths.dist,
filename: '[name].js',
chunkFilename: '[chunkhash].js',
// publicPath: 'http://localhost:3000/static/'
publicPath: ''
// publicPath: `http://localhost:${port}/`
},
plugins: [
new ExtractTextPlugin('index.css', {
allChunks: true
}),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new webpack.ProvidePlugin({
'Promise': 'exports?global.Promise!es6-promise',
// import fetch
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false,
// remove `console.*`
drop_console: true
},
output: {
comments: false
}
})
],
stats: {
// Nice colored output
colors: true
},
module: {
loaders: [{
// @TODO containers
test: /\.html$/,
loader: 'file',
query: {
name: '[name].[ext]'
}
}, {
test: /\.json$/,
loader: 'json'
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?modules'),
include: paths.src_path
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css'),
include: paths.node_modules
}, {
test: /\.styl$/,
// 'style!css?modules!stylus',
loader: ExtractTextPlugin.extract('style', 'css?modules!stylus'),
include: paths.src_path
}, {
test: /\.jsx?$/,
loader: 'babel',
// only handle js file in src
include: paths.src_path
}, {
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=img/[name].[hash:8].[ext]',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false&progressive=true'
]
}],
noParse: [
// 'react/dist/react.js',
// 'react-dom/dist/react-dom.js'
]
},
resolve: {
}
}