-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathrspackConfig.js
More file actions
34 lines (29 loc) · 1.14 KB
/
rspackConfig.js
File metadata and controls
34 lines (29 loc) · 1.14 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
const clientRspackConfig = require('./clientRspackConfig');
const serverRspackConfig = require('./serverRspackConfig');
const rspackConfig = (envSpecific) => {
const clientConfig = clientRspackConfig();
const serverConfig = serverRspackConfig();
if (envSpecific) {
envSpecific(clientConfig, serverConfig);
}
let result;
// For HMR, need to separate the the client and server rspack configurations
if (process.env.WEBPACK_SERVE || process.env.CLIENT_BUNDLE_ONLY) {
// eslint-disable-next-line no-console
console.log('[React on Rails] Creating only the client bundles.');
result = clientConfig;
} else if (process.env.SERVER_BUNDLE_ONLY) {
// eslint-disable-next-line no-console
console.log('[React on Rails] Creating only the server bundle.');
result = serverConfig;
} else {
// default is the standard client and server build
// eslint-disable-next-line no-console
console.log('[React on Rails] Creating both client and server bundles.');
result = [clientConfig, serverConfig];
}
// To debug, uncomment next line and inspect "result"
// debugger
return result;
};
module.exports = rspackConfig;