-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
59 lines (59 loc) · 1.48 KB
/
webpack.config.js
File metadata and controls
59 lines (59 loc) · 1.48 KB
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
53
54
55
56
57
58
59
const webpack = require('webpack');
const path = require('path');
const pkg = require('./package.json');
module.exports = (env) => {
const isProduction = env === 'production';
const watch = process.env.WATCH === 'true';
return {
entry: {
'tabs-more-button': watch ? './src/api.js' : './lib/esm/api.js',
},
optimization: {
removeAvailableModules: true,
removeEmptyChunks: true,
flagIncludedChunks: true,
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.BannerPlugin({
raw: true,
banner: `/**
* ${pkg.name} - ${pkg.description}
*
* @version v${pkg.version}
* @homepage ${pkg.homepage}
* @author ${pkg.author.name} ${pkg.author.email}
* @license ${pkg.license}
*/`,
entryOnly: true,
}),
],
watch,
output: {
filename: `[name]${isProduction ? '.min' : ''}.js`,
path: path.resolve(__dirname, 'dist'),
library: 'tabsMoreButton',
libraryTarget: 'umd',
publicPath: '/dist/',
umdNamedDefine: true,
},
devtool: 'source-map',
mode: 'development',
module: {
rules: [
watch
? {
test: /\.m?js$/,
exclude: /(node_modules)/,
use: {
loader: 'babel-loader',
options: {
presets: [['@babel/preset-env', {loose: true, modules: false}]],
},
},
}
: {},
],
},
};
};