-
Notifications
You must be signed in to change notification settings - Fork 8
/
webpack.iframe.js
62 lines (56 loc) · 1.44 KB
/
webpack.iframe.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
/*
Copyright (c) 2022 Skyflow, Inc.
*/
const { merge } = require('webpack-merge');
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
const terserWebpackPlugin = require('terser-webpack-plugin');
const CompressionPlugin = require('compression-webpack-plugin');
const HtmlWebPackPlugin = require('html-webpack-plugin');
const common = require('./webpack.common.js');
const minify = {
collapseWhitespace: true,
removeComments: true,
removeRedundantAttributes: true,
removeScriptTypeAttributes: true,
removeStyleLinkTypeAttributes: true,
useShortDoctype: true,
minifyCSS: true,
minifyJS: true,
};
module.exports = () => merge(common, {
mode: 'production',
entry: {
index: [
path.resolve(__dirname, 'src/index-internal.ts'),
],
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'dist/v1/elements'),
},
optimization: {
runtimeChunk: false,
minimizer: [new terserWebpackPlugin()],
},
module: {
rules: [],
},
// todo: add minifier for css in html file
plugins: [
new HtmlWebPackPlugin({
filename: 'index.html',
template: 'assets/iframe.html',
chunks: ['index'],
inject: 'head',
minify,
}),
new CleanWebpackPlugin({
verbose: true,
dry: false,
}),
new WebpackManifestPlugin(),
new CompressionPlugin(),
],
});