-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.prod.js
34 lines (29 loc) · 883 Bytes
/
webpack.prod.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
const { merge } = require('webpack-merge');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const common = require('./webpack.common');
const { AddVersion } = require('./webpack.addVersion');
const { PluginGetFileSize } = require('./webpack.fileSize');
const options = merge(common, {
mode: 'production',
plugins: [],
module: {
rules: [],
},
});
const { ENV } = process.env;
const genHtml = ENV === 'preview';
if (genHtml) {
options.plugins.push(
new HtmlWebpackPlugin({
template: 'dist/template.html',
filename: 'index.html',
}),
new CopyPlugin({
patterns: [{ from: 'public', to: '' }],
})
);
} else {
options.plugins.push(new AddVersion(), new PluginGetFileSize('trilium-chat.js'));
}
module.exports = options;