-
Notifications
You must be signed in to change notification settings - Fork 1
/
aunty.config.js
47 lines (41 loc) · 1.08 KB
/
aunty.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
const fs = require('fs');
const path = require('path');
const ADDITIONAL_ENTRY_POINTS = ['editor', 'standalone', 'doc-block', 'illustrations', 'live', 'blanks'];
module.exports = {
type: 'react',
serve: {
hot: false
},
webpack: config => {
config.devtool = 'source-map';
ADDITIONAL_ENTRY_POINTS.forEach(name => {
config.entry[name] = [config.entry.index[0].replace('index', name)];
});
// Stop `import()`-ed chunks from being split into `[name].js` and `vendors~[name].js`
config.optimization = {
...(config.optimization || {}),
splitChunks: {
cacheGroups: {
vendors: false
}
}
};
return config;
},
deploy: [
{
to: '/www/res/sites/news-projects/<name>/<id>'
},
config => {
fs.writeFileSync(
path.join(__dirname, 'redirect', 'index.js'),
`window.location = String(window.location).replace('/latest/', '/${config.id}/')`
);
return {
...config,
from: 'redirect',
to: '/www/res/sites/news-projects/<name>/latest'
};
}
]
};