-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.prod.js
More file actions
executable file
·50 lines (47 loc) · 1.2 KB
/
Copy pathwebpack.prod.js
File metadata and controls
executable file
·50 lines (47 loc) · 1.2 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
import path from 'path';
import { merge } from 'webpack-merge';
import { CleanWebpackPlugin } from 'clean-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import common from './webpack.common.js';
const terserOptions = {
minimize: true,
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
compress: {
pure_funcs: ['console.log', 'console.debug']
},
format: {
comments: false,
},
}
})
]
};
const distPath = path.join(common.context, 'dist');
const jsEntry = path.join(common.context, 'src/js/index.js');
const cssEntry = path.join(common.context, 'src/scss/main.scss');
export default merge(common, {
mode: 'production',
entry: {
'sadrazam.esm.js': jsEntry,
'sadrazam.min.junk': cssEntry
},
output: {
path: distPath,
filename: '[name]',
chunkFormat: false,
library: { type: 'module' },
module: true
},
experiments: { outputModule: true },
plugins: [
new CleanWebpackPlugin({
cleanOnceBeforeBuildPatterns: ['**/*.min.js'],
cleanAfterEveryBuildPatterns: ['**/*.junk'],
protectWebpackAssets: false
})
],
optimization: terserOptions
});