forked from davidmerfield/Typeset
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
48 lines (44 loc) · 1.07 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
var webpack = require('webpack');
var pkg = require('./package.json');
var PROD = process.env.PROD;
var banner = [
pkg.name + ' - ' + pkg.description,
'@version v' + pkg.version,
'@link ' + pkg.homepage,
'@author ' + pkg.author,
'@license ' + pkg.license
].join('\n');
var devPlugins = [
new webpack.BannerPlugin(banner),
new webpack.DefinePlugin({
'ENV': {
browser: true
}
})
];
var prodPlugins = [
new webpack.BannerPlugin(banner),
new webpack.DefinePlugin({
'ENV': {
browser: true
}
}),
new webpack.optimize.UglifyJsPlugin({minimize: true})
]
// webpack.config.js
// Configuration for build typeset with browser support
// jQuery is a external dependency
module.exports = {
entry: __dirname + '/src/index.js',
devtool: 'source-map',
output: {
library: pkg.name,
path: __dirname + '/build',
filename: PROD ? "typeset.min.js" : 'typeset.js'
},
externals: {
cheerio: 'jQuery', //TODO I think there should be another way to avoid require cheerio
jquery: 'jQuery'
},
plugins: PROD && prodPlugins || devPlugins
}