-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.prod.config.js
49 lines (43 loc) · 1.44 KB
/
webpack.prod.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
const baseConfig = require('./webpack.base.config');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const BundleTracker = require('webpack-bundle-tracker');
const path = require('path');
const nodeModulesDir = path.resolve(__dirname, 'node_modules');
// Uncomment next line to enable source-map
// Having source-map in production might not be a good idea - if you're concerned about people stealing your code
// baseConfig[1].devtool = '#source-map';
baseConfig[1].entry = [
'bootstrap-loader/extractStyles',
'./assets/js/index.js',
];
baseConfig[1].output = {
path: path.resolve('./assets/bundles/'),
publicPath: '',
filename: '[name]-[hash].js',
};
baseConfig[1].module.loaders.push({
test: /\.jsx?$/,
exclude: [nodeModulesDir],
loaders: ['babel?presets[]=react,presets[]=es2015']
});
baseConfig[1].plugins = [
new webpack.DefinePlugin({ // removes React warnings
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new ExtractTextPlugin('[name]-[hash].css', {allChunks: true}),
new webpack.optimize.UglifyJsPlugin({comments: false}),
new BundleTracker({
filename: './webpack-stats.json'
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
"window.Tether": 'tether',
"Tether": 'tether',
})
];
module.exports = baseConfig;