/
webpack.config.js
48 lines (41 loc) 路 1.37 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
'use strict';
var readPkg = require('read-pkg');
module.exports = async () => {
var pkg = await readPkg();
var author = pkg.author.name + ' <' + pkg.author.email + '> (' + pkg.author.url + ')';
return {
mode: 'none',
entry: {
'super-event-emitter': './index.js',
},
output: {
library: 'EventEmitter',
libraryTarget: 'umd',
filename: '[name].js',
path: __dirname + '/dist/'
},
devtool: 'source-map',
module: {
rules: [
{
test: /\.json$/,
loader: 'json-loader'
},
{
test: /\.js$/,
loader: 'string-replace-loader',
query: {
multiple: [
{ search: '$AUTHOR$', replace: author },
{ search: '$NAME$', replace: pkg.name },
{ search: '$DESCRIPTION$', replace: pkg.description },
{ search: '$VERSION$', replace: pkg.version },
{ search: '$PKG_VERSION$', replace: pkg.version },
{ search: '$LICENSE$', replace: pkg.license }
]
}
}
]
}
};
};