-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
84 lines (79 loc) · 2.19 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
const path = require('path');
const webpack = require('webpack');
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const banner = '' + Date.now();
const autoprefixer = require('autoprefixer');
module.exports = {
entry: {
polyfill: 'babel-polyfill',
bundle: "./index.jsx"
},
output: {
path: path.join(__dirname, 'dist'),
filename: "[name].js"
},
module: {
loaders: [{
test: /\.jsx$/,
exclude: /(node_modules|bower_components)/,
loaders: ['babel-loader']
},
/* Style loader **/
{
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
},
{
test: /\.js$/,
exclude: /node_modules/,
loaders: ['react-hot-loader/webpack', 'babel']
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: 'url?limit=10000!img?progressive=true'
},
/* Font Files **/
{
test: /\.(woff|woff2|eot|ttf|svg|otf)(\?\S*)?$/,
exclude: /node_modules/,
loader: 'url-loader?limit=1024&name=[path][name].[ext]'
},
/* Icomoon Icons **/
{
test: /\icomoon.woff$/,
loader: "url-loader?limit=10000&mimetype=application/font-woff&name=[path][name].[ext]"
},
{
test: /\icomoon.ttf$/,
loader: "url-loader?limit=10000&mimetype=application/octet-stream&name=[path][name].[ext]"
},
{
test: /\icomoon.svg$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml&name=[path][name].[ext]"
}
],
},
// postcss: [ autoprefixer({ browsers: ['last 3 versions', '> 1%'] }) ],
plugins: [
new webpack.BannerPlugin(banner),
new ExtractTextPlugin("style.css"),
new webpack.DefinePlugin({
'process.env': {
'NODE_ENV': JSON.stringify('production')
}
}),
new CopyWebpackPlugin([{
from: './app/util/polyfill.js',
to: 'polyfill.js',
toType: 'file'
}])
],
resolve: {
extensions: ['', '.js', '.jsx'],
},
devtool: 'cheap-module-source-map',
devServer: {
stats: 'errors-only',
}
};
// "style-loader!css-loader?localIdentName=[path][name]__[hash:base64:5]__[local]!less-loader