-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
52 lines (44 loc) · 1.38 KB
/
webpack.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
let webpack = require('webpack');
let path = require('path');
// Naming and path settings
let appName = 'app';
let entryPoint = path.resolve(__dirname, './index.js');
let exportPath = path.resolve(__dirname, './');
let plugins = [
new webpack.ProvidePlugin({
Promise: 'es6-promise-promise',
$: 'jquery',
jQuery: 'jquery'
})
];
// Differ settings based on production flag
plugins.push(new webpack.optimize.UglifyJsPlugin({ minimize: true }));
plugins.push(new webpack.optimize.LimitChunkCountPlugin({maxChunks: 15}));
plugins.push(new webpack.optimize.MinChunkSizePlugin({minChunkSize: 10000}));
//appName = appName + '.min.js';
appName = appName + '.js';
// Main Settings config
module.exports = {
cache: true,
entry: ['babel-polyfill', entryPoint],
devtool: 'source-map',
output: {
path: exportPath,
filename: appName
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
query: {
presets: ['es2015']
}
}
]
},
// Use this anly if you need full compilation, not runtime-only.
// Warning! It makes compilation slower!
plugins // please keep all plugins in plugins variable. Otherwise plugins for optimisation are overwritten
};