-
Notifications
You must be signed in to change notification settings - Fork 0
/
razzle.config.js
31 lines (28 loc) · 972 Bytes
/
razzle.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
const fs = require('fs');
const path = require('path');
const appDirectory = fs.realpathSync(process.cwd());
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
module.exports = {
modify(config, { target, dev }, webpack) {
const appConfig = config; // stay immutable here
if (!dev) {
appConfig["output"]["publicPath"] =
"https://d24gftfomm9wsp.cloudfront.net/";
}
if (target == 'web') {
if (appConfig['entry']['client'].pop) {
appConfig['entry']['client'].pop();
appConfig['entry']['client'].push(resolveApp('src/client/client'));
} else {
appConfig['entry']['client'] = resolveApp('src/client/client');
}
} else if (target == 'node') {
appConfig['node']['__dirname'] = true;
appConfig['node']['__filename'] = true;
appConfig['entry'].pop();
appConfig['entry'].push(resolveApp('src/server'));
} else {
}
return appConfig;
},
};