-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.js
74 lines (71 loc) · 1.79 KB
/
webpack.config.prod.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
import webpack from 'webpack';
import path from 'path';
import ExtractTextPlugin from 'extract-text-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
title: 'ChingChingTest',
template: __dirname + '/src/index.html',
filename: 'index.html',
inject: 'body'
});
const GLOBALS = {
'process.env.NODE_ENV': JSON.stringify('production')
};
export default {
debug: true,
devtool: 'source-map',
noInfo: false,
entry: path.resolve(__dirname, 'src/index.js'),
target: 'web',
output: {
path: __dirname + '/dist', // Note: Physical files are only output by the production build task `npm run build`.
publicPath: '',
filename: "bundle.js"
},
devServer: {
contentBase: path.resolve(__dirname, 'dist')
},
plugins: [
HtmlWebpackPluginConfig,
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.DefinePlugin(GLOBALS),
new ExtractTextPlugin('css/main.css', {
allChunks: true
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin()
],
module: {
loaders: [
{
test: /(\.jsx?$|\.js$)/,
include: path.join(__dirname, 'src'),
exclude: /(node_modules)/,
loaders: ['babel']
},
{
test : /\.css$/,
loader: "style-loader!css-loader?sourceMap"
},
{
test: /(\.sass$|\.scss$)/,
loader: ExtractTextPlugin.extract(
'style', // The backup style loader
'css?sourceMap!sass?sourceMap&includePaths[]=./sass',
{ publicPath: '../'}
)
},
{
test: /\.(ttf|eot|svg|woff(2)?)(\?\S*)?$/,
loader: "file-loader?name=fonts/[name].[ext]"
},
{
test: /\.(jpe?g|png|gif|svg)$/i,
loaders: [
'file-loader?name=img/[name].[ext]&context=./img',
'image-webpack?bypassOnDebug&optimizationLevel=7&interlaced=false'
]
}
]
}
};