Skip to content

Commit cc75b16

Browse files
committed
Support new environment variable: BUILD_PATH
1 parent 5867170 commit cc75b16

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/react-scripts/config/paths.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const publicUrlOrPath = getPublicUrlOrPath(
2929
process.env.PUBLIC_URL
3030
);
3131

32+
const buildPath = process.env.BUILD_PATH || 'build';
33+
3234
const moduleFileExtensions = [
3335
'web.mjs',
3436
'mjs',
@@ -60,7 +62,7 @@ const resolveModule = (resolveFn, filePath) => {
6062
module.exports = {
6163
dotenv: resolveApp('.env'),
6264
appPath: resolveApp('.'),
63-
appBuild: resolveApp('build'),
65+
appBuild: resolveApp(buildPath),
6466
appPublic: resolveApp('public'),
6567
appHtml: resolveApp('public/index.html'),
6668
appIndexJs: resolveModule(resolveApp, 'src/index'),
@@ -83,7 +85,7 @@ const resolveOwn = relativePath => path.resolve(__dirname, '..', relativePath);
8385
module.exports = {
8486
dotenv: resolveApp('.env'),
8587
appPath: resolveApp('.'),
86-
appBuild: resolveApp('build'),
88+
appBuild: resolveApp(buildPath),
8789
appPublic: resolveApp('public'),
8890
appHtml: resolveApp('public/index.html'),
8991
appIndexJs: resolveModule(resolveApp, 'src/index'),
@@ -119,7 +121,7 @@ if (
119121
module.exports = {
120122
dotenv: resolveOwn(`${templatePath}/.env`),
121123
appPath: resolveApp('.'),
122-
appBuild: resolveOwn('../../build'),
124+
appBuild: resolveOwn(path.join('../..', buildPath)),
123125
appPublic: resolveOwn(`${templatePath}/public`),
124126
appHtml: resolveOwn(`${templatePath}/public/index.html`),
125127
appIndexJs: resolveModule(resolveOwn, `${templatePath}/src/index`),

0 commit comments

Comments
 (0)