-
-
Notifications
You must be signed in to change notification settings - Fork 38
/
webpack.config.js
30 lines (28 loc) · 944 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
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const webpack = require('webpack');
const pkg = require('./package.json');
const banner = pkg.name + ' v' + pkg.version + ' | (c) ' + new Date().getFullYear() + ' ' + pkg.author + ' | ' + pkg.license + ' | ' + pkg.homepage;
const env = process.env;
const plugins = [
new webpack.BannerPlugin(banner)
];
const USE_TERSER_PLUGIN = (env.BUILD_ENV === 'dist');
module.exports = {
mode: 'development',
entry: path.resolve(__dirname, 'lib/index.js'),
output: {
path: path.join(__dirname, 'dist'),
filename: env.BUILD_ENV === 'dist' ? 'infinite-tree.min.js' : 'infinite-tree.js',
libraryTarget: 'umd',
library: 'InfiniteTree'
},
optimization: {
minimizer: [
USE_TERSER_PLUGIN && (
new TerserPlugin()
)
].filter(Boolean)
},
plugins: plugins,
};