forked from weaveworks/promjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
43 lines (40 loc) · 1004 Bytes
/
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
const UglifyJsPlugin = require('uglifyjs-webpack-plugin')
module.exports = (env, options) => {
const LIBRARY_NAME = 'promjs';
const plugins = [];
let mode;
let outputFile;
if (options.mode === 'production') {
plugins.push(new UglifyJsPlugin());
outputFile = `${LIBRARY_NAME}.min.js`;
mode = 'production';
} else {
outputFile = `${LIBRARY_NAME}.js`;
mode = 'development';
}
return {
entry: `${__dirname}/src/index.ts`,
mode,
output: {
path: `${__dirname}/lib/browser`,
filename: outputFile,
library: LIBRARY_NAME,
libraryTarget: 'var'
},
resolve: {
extensions: ['.ts', '.js', '.json']
},
module: {
rules: [{
test: /(\.ts)$/,
loader: 'babel-loader',
exclude: /(node_modules)/,
query: {
plugins: ['lodash', '@babel/proposal-class-properties', '@babel/proposal-object-rest-spread'],
presets: ['@babel/env']
}
}]
},
plugins
};
};