forked from mailgun/mailgun.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.base.config.js
73 lines (68 loc) · 1.64 KB
/
webpack.base.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
var webpack = require('webpack');
var pkg = require('./package.json');
module.exports = function(env) {
var filename = '[name]';
var outputDir = 'build';
if (env === 'release') {
outputDir = 'dist';
}
var config = {
context: __dirname,
entry: {
mailgun: './index.js',
'mailgun.min': './index.js'
},
output: {
path: __dirname + '/' + outputDir,
filename: filename + '.js',
library: 'mailgun',
libraryTarget: 'umd'
},
plugins: [
new webpack.optimize.UglifyJsPlugin({
mangle: {
screw_ie8: true
},
compress: {
screw_ie8: true,
warnings: false,
sequences: true,
dead_code: true,
conditionals: true,
booleans: true,
unused: true,
if_return: true,
join_vars: true,
drop_console: true
},
include: ['mailgun.min.js'],
output: {comments: false}
}),
new webpack.BannerPlugin(pkg.name + ' v' + pkg.version),
new webpack.NoErrorsPlugin()
],
module: {
preLoaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'jscs-loader'
}
],
loaders: [
{ test: /\.js$/, loader: 'babel', exclude: /(node_modules)/},
{ include: /\.json$/, loader: 'json', exclude: /(node_modules)/},
]
},
resolve: {
extensions: ['', '.json', '.js']
},
devtool: 'source-map',
jscs: {}
};
if (env === 'release') {
config.jscs.failOnHint = true;
config.plugins.push(new webpack.optimize.DedupePlugin());
}
return config;
};