-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
69 lines (61 loc) · 1.54 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
const path = require('path');
const webpack = require('webpack');
const BundleTracker = require('webpack-bundle-tracker');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const PATHS = {
app: path.join(__dirname, 'assets', 'js'),
style: path.join(__dirname, 'assets', 'css'),
dist: path.join(__dirname, 'assets', 'bundles'),
};
module.exports = {
devtool: 'cheap-source-map',
context: __dirname,
entry: [
path.resolve(PATHS.app, 'index.jsx'),
],
output: {
path: PATHS.dist,
filename: '[name]-[hash].js'
},
plugins: [
new BundleTracker({
comments: false,
filename: './webpack-stats-prod.json',
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
comments: false,
sourcemap: false
}),
new ExtractTextPlugin('[name].css'),
],
module: {
loaders: [
{ test: /\.(jsx|js)$/,
include: PATHS.app,
loaders: ['babel'],
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('css!less'),
},
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'url-loader?limit=10000&minetype=application/font-woff',
},
{
test: /\.(ttf|eot|svg|jpg|png)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: 'file-loader',
},
],
},
resolve: {
modulesDirectories: ['node_modules', 'bower_components'],
extensions: ['', '.js', '.jsx'],
},
};