-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
64 lines (63 loc) · 1.41 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
53
54
55
56
57
58
59
60
61
62
63
64
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const {LicenseWebpackPlugin} = require('license-webpack-plugin');
const path = require('path');
const banner = (({name, version, author, license}) => {
return `
/*!
* ${name} v${version}
* author: ${author}
* license: ${license}
*/
`;
})(require('./package.json'));
module.exports = {
entry: {
'html-code-block-element.core.min': './dist/index.core.js',
'html-code-block-element.common.min': './dist/index.common.js',
'html-code-block-element.all.min': './dist/index.all.js',
},
output: {
path: path.join(__dirname, 'lib'),
library: 'HTMLCodeBlockElement',
libraryExport: 'HTMLCodeBlockElement',
libraryTarget: 'window',
},
resolve: {
extensions: ['.ts', '.js'],
},
module: {
rules: [
{
test: /\.(ts|js)$/,
loader: 'babel-loader',
},
],
},
performance: {
maxEntrypointSize: 1200000,
maxAssetSize: 1200000,
},
devServer: {
open: true,
static: [path.resolve(__dirname, 'demo'), path.resolve(__dirname, 'lib')],
},
plugins: [
new webpack.BannerPlugin({
banner,
raw: true,
entryOnly: true,
}),
new LicenseWebpackPlugin(),
],
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
keep_classnames: true,
},
}),
],
},
};