Skip to content

Commit dea6090

Browse files
committed
Update config in 20.4 saga part
1 parent 86d9576 commit dea6090

File tree

8 files changed

+4375
-3423
lines changed

8 files changed

+4375
-3423
lines changed

20/20.4/ssr-recipe (saga)/config/env.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ if (!NODE_ENV) {
1717
// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use
1818
const dotenvFiles = [
1919
`${paths.dotenv}.${NODE_ENV}.local`,
20-
`${paths.dotenv}.${NODE_ENV}`,
2120
// Don't include `.env.local` for `test` environment
2221
// since normally you expect tests to produce the same
2322
// results for everyone
2423
NODE_ENV !== 'test' && `${paths.dotenv}.local`,
24+
`${paths.dotenv}.${NODE_ENV}`,
2525
paths.dotenv,
2626
].filter(Boolean);
2727

@@ -85,6 +85,11 @@ function getClientEnvironment(publicUrl) {
8585
WDS_SOCKET_HOST: process.env.WDS_SOCKET_HOST,
8686
WDS_SOCKET_PATH: process.env.WDS_SOCKET_PATH,
8787
WDS_SOCKET_PORT: process.env.WDS_SOCKET_PORT,
88+
// Whether or not react-refresh is enabled.
89+
// react-refresh is not 100% stable at this time,
90+
// which is why it's disabled by default.
91+
// It is defined here so it is available in the webpackHotDevClient.
92+
FAST_REFRESH: process.env.FAST_REFRESH !== 'false',
8893
}
8994
);
9095
// Stringify all values so we can feed into webpack DefinePlugin

20/20.4/ssr-recipe (saga)/config/modules.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,8 @@ const resolve = require('resolve');
1414
function getAdditionalModulePaths(options = {}) {
1515
const baseUrl = options.baseUrl;
1616

17-
// We need to explicitly check for null and undefined (and not a falsy value) because
18-
// TypeScript treats an empty string as `.`.
19-
if (baseUrl == null) {
20-
// If there's no baseUrl set we respect NODE_PATH
21-
// Note that NODE_PATH is deprecated and will be removed
22-
// in the next major release of create-react-app.
23-
24-
const nodePath = process.env.NODE_PATH || '';
25-
return nodePath.split(path.delimiter).filter(Boolean);
17+
if (!baseUrl) {
18+
return '';
2619
}
2720

2821
const baseUrlResolved = path.resolve(paths.appPath, baseUrl);

20/20.4/ssr-recipe (saga)/config/paths.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
1+
'use strict';
22

33
const path = require('path');
44
const fs = require('fs');
@@ -7,7 +7,7 @@ const getPublicUrlOrPath = require('react-dev-utils/getPublicUrlOrPath');
77
// Make sure any symlinks in the project folder are resolved:
88
// https://github.com/facebook/create-react-app/issues/637
99
const appDirectory = fs.realpathSync(process.cwd());
10-
const resolveApp = relativePath => path.resolve(appDirectory, relativePath);
10+
const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath);
1111

1212
// We use `PUBLIC_URL` environment variable or "homepage" field to infer
1313
// "public path" at which the app is served.
@@ -37,7 +37,7 @@ const moduleFileExtensions = [
3737

3838
// Resolve file paths in the same order as webpack
3939
const resolveModule = (resolveFn, filePath) => {
40-
const extension = moduleFileExtensions.find(extension =>
40+
const extension = moduleFileExtensions.find((extension) =>
4141
fs.existsSync(resolveFn(`${filePath}.${extension}`))
4242
);
4343

@@ -64,11 +64,10 @@ module.exports = {
6464
testsSetup: resolveModule(resolveApp, 'src/setupTests'),
6565
proxySetup: resolveApp('src/setupProxy.js'),
6666
appNodeModules: resolveApp('node_modules'),
67+
swSrc: resolveModule(resolveApp, 'src/service-worker'),
68+
publicUrlOrPath,
6769
ssrIndexJs: resolveApp('src/index.server.js'),
6870
ssrBuild: resolveApp('dist'),
69-
publicUrlOrPath,
7071
};
7172

72-
73-
7473
module.exports.moduleFileExtensions = moduleFileExtensions;

0 commit comments

Comments
 (0)