/
_config.js
49 lines (49 loc) · 934 Bytes
/
_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
const augment1 = '/*foo*/';
const augment2 = '/*bar*/';
module.exports = {
description: 'augmentChunkHash updates hashes across all modules when returning something',
options1: {
input: 'main',
output: {
format: 'esm',
entryFileNames: '[name]-[hash].js',
chunkFileNames: '[name]-[hash].js'
},
plugins: [
{
augmentChunkHash(chunk) {
if (chunk.name === 'main') {
return augment1;
}
},
renderChunk(code, chunk) {
if (chunk.name === 'main') {
return augment1 + code;
}
}
}
]
},
options2: {
input: 'main',
output: {
format: 'esm',
entryFileNames: '[name]-[hash].js',
chunkFileNames: '[name]-[hash].js'
},
plugins: [
{
augmentChunkHash(chunk) {
if (chunk.name === 'main') {
return augment2;
}
},
renderChunk(code, chunk) {
if (chunk.name === 'main') {
return augment2 + code;
}
}
}
]
}
};