forked from vinta/pangu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
52 lines (47 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
49
50
51
52
var _ = require('underscore');
var fs = require('fs');
var webpack = require('webpack');
var packageInfo = require('./package.json');
var uglifyPlugin = new webpack.optimize.UglifyJsPlugin({
include: /\.min\.js$/,
minimize: true
})
var bannerTemplate = fs.readFileSync('src/browser/banner.txt', {encoding: 'utf8'});
var bannerText = _.template(bannerTemplate)(packageInfo);
var bannerPlugin = new webpack.BannerPlugin(bannerText, {
include: /^pangu/,
raw: true,
entryOnly: true
});
var entryPath = './src/browser/pangu.js';
module.exports = {
entry: {
'pangu': entryPath,
'pangu.min': entryPath
},
output: {
path: './dist/browser/',
filename: '[name].js',
library: 'pangu',
libraryTarget: 'umd',
umdNamedDefine: true
},
devtool: 'source-map',
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
plugins: ['add-module-exports'],
presets: ['es2015']
}
}
]
},
plugins: [
uglifyPlugin,
bannerPlugin
]
}