-
Notifications
You must be signed in to change notification settings - Fork 30
/
webpack.common.config.js
74 lines (73 loc) · 1.9 KB
/
webpack.common.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
var webpack = require('webpack');
var ngAnnotatePlugin = require('ng-annotate-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var WebpackMd5Hash = require('webpack-md5-hash');
var path = require('path');
module.exports = {
cache: true,
entry: {
app: './src/app.js',
vendor: './src/vendor.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '',
filename: '[name].[chunkhash].js',
chunkFilename: '[id].[chunkhash].js'
},
stats: {
// Configure the console output
colors: true,
modules: true,
reasons: true
},
module: {
loaders: [
{
test: /\.js?$/,
loader: 'babel-loader',
exclude: /node_modules/,
query: {
presets: [
['env', {
'targets': {
'browsers': ['last 2 versions']
}
}]
]
}
},
{ test: /\.css$/, loader: ExtractTextPlugin.extract({fallback: 'style-loader', use: 'css-loader' })},
{ test: /\.(woff2?|ttf|eot|svg)$/, loader: 'file-loader?name=fonts/[name].[ext]' },
]
},
plugins: [
new WebpackMd5Hash(),
new webpack.optimize.CommonsChunkPlugin({
name: ['app', 'vendor']
}),
new CopyWebpackPlugin([
{ from: 'www' }
]),
new HtmlWebpackPlugin({
template: 'html-loader!./www/index.html',
}),
new ExtractTextPlugin('[name].[chunkhash].css'),
new webpack.ProvidePlugin({
'Promise': 'es6-promise' // Thanks Aaron (https://gist.github.com/Couto/b29676dd1ab8714a818f#gistcomment-1584602)
}),
new ngAnnotatePlugin({add: true}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
sourceMap: true
})
],
node: {
fs: 'empty'
},
profile: true
};