This repository has been archived by the owner on May 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
58 lines (57 loc) · 2.17 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
var path = require('path');
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry:{
app: './src/index',
},
output: {
path: path.join(__dirname, 'public/assets/'),
filename: 'app.[hash].js',
//chunkFilename: '[id].[hash].chunk.js',
publicPath: '/assets/'
},
plugins: [
new webpack.DefinePlugin({"process.env": {NODE_ENV: JSON.stringify("production")}}),
new webpack.optimize.UglifyJsPlugin({
mangle: true,
compress: true,
beautify: true,
output: {
beautify: false,
ascii_only: true
}
}),
new webpack.optimize.DedupePlugin(),
new webpack.NoErrorsPlugin(),
new webpack.optimize.CommonsChunkPlugin('app', null, Infinity),
new ExtractTextPlugin("[name].[hash].css", {allChunks: true}),
new HtmlWebpackPlugin({title: "React • Starter Kit", filename: '../index.html', template: 'index.tmpl'})
],
resolve: {
extensions: ['', '.js', '.jsx', '.less', '.css']
},
module: {
preLoaders: [{
test: /\.js$/,
loaders: ['babel'],
include: [path.resolve(__dirname, "node_modules/formsy-react")]
}],
loaders: [
{
test: /\.jsx?$/, loader: 'babel',
exclude: path.resolve(__dirname, 'node_modules'),
include: path.join(__dirname, 'src')
},
{ test: /\.less$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader") },
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader!autoprefixer?browsers=last 3 versions") },
{ test: /\.(png|jpg|jpeg|gif)$/, loader: 'url-loader?limit=8192' },
{ test: /\.woff(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.woff2(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/font-woff" },
{ test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=application/octet-stream" },
{ test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, loader: "file" },
{ test: /\.svg(\?v=\d+\.\d+\.\d+)?$/, loader: "url?limit=10000&mimetype=image/svg+xml" }
]
}
};