forked from iroy2000/react-reflux-boilerplate-with-webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
52 lines (50 loc) · 1.78 KB
/
webpack.production.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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var DEFAULT_IMG_OPT_STRING = 'image?bypassOnDebug&optimizationLevel=7';
var DEFAULT_FILE_LOADER_STRING = 'file?hash=sha512&digest=hex&name=assets/[hash].[ext]';
var commonLoaders = [
{test: /\.(png|svg)$/i, loaders: [DEFAULT_FILE_LOADER_STRING, DEFAULT_IMG_OPT_STRING + '&interlaced=true']},
{test: /\.(gif)$/i, loaders: [DEFAULT_FILE_LOADER_STRING, DEFAULT_IMG_OPT_STRING + '&interlaced=false']},
{test: /\.(jpe?g)$/i, loaders: [DEFAULT_FILE_LOADER_STRING, DEFAULT_IMG_OPT_STRING + '&interlaced=false&progressive=true']},
{test: /\.css$/, loader: "style-loader!css-loader" }
];
module.exports = {
entry: {
app: [
'./src/scripts/components/router'
]
},
devtool: 'source-map',
output: {
path: path.join(__dirname, "public"),
filename: "bundle.js"
},
resolveLoader: {
modulesDirectories: ['..', 'node_modules']
},
plugins: [
new webpack.DefinePlugin({
// This has effect on the react lib size.
"process.env": {
NODE_ENV: JSON.stringify("production")
}
}),
new webpack.IgnorePlugin(/vertx/),
new webpack.IgnorePlugin(/un~$/),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin()
],
resolve: {
// you can now require('myfile') instead of require('myfile.cjsx')
extensions: ['', '.js', '.jsx', '.cjsx', '.coffee']
},
module: {
loaders: commonLoaders.concat([
{ test: /\.styl$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader!stylus')},
{ test: /\.cjsx$/, loaders: ['react-hot', 'coffee', 'cjsx']},
{ test: /\.coffee$/, loader: 'coffee' },
{ test: /\.jsx$|\.js$/, loader: 'jsx-loader?harmony' }
])
}
};