-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
53 lines (48 loc) · 1.31 KB
/
index.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
const path = require('path');
const fs = require('fs');
module.exports = {
managerWebpack(config, options) {
// update config here
const templateParametersGenerator = config.plugins[1].options.templateParameters;
config.plugins[1].options.templateParameters = (...args) => {
const headHtmlSnippet = fs.readFileSync('./manager-head.html', 'utf8');
const templateParameters = templateParametersGenerator(...args);
return {
...templateParameters,
headHtmlSnippet: headHtmlSnippet + templateParameters.headHtmlSnippet
};
};
return config;
},
managerBabel(config, options) {
// update config here
return config;
},
webpack(config, options) {
return config;
},
webpackFinal(config, options) {
const templateParametersGenerator = config.plugins[0].options.templateParameters;
config.plugins[0].options.templateParameters = (...args) => {
const headHtmlSnippet = fs.readFileSync('./preview-head.html', 'utf8');
const templateParameters = templateParametersGenerator(...args);
return {
...templateParameters,
headHtmlSnippet: headHtmlSnippet + templateParameters.headHtmlSnippet
};
};
return config;
},
babel(config, options) {
return config;
},
addons(entry = []) {
return entry;
},
entries(entries) {
return [
...entries,
path.resolve('./setup.js')
];
}
};