From 68b7b0477345bc48f6cd9736d3d5e94d35e641d6 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Tue, 25 Aug 2020 19:31:41 +0800 Subject: [PATCH] flood: do not use current working path to retrieve assets --- client/config/env.js | 3 +-- shared/config/paths.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/client/config/env.js b/client/config/env.js index d911837f..d117c373 100644 --- a/client/config/env.js +++ b/client/config/env.js @@ -1,4 +1,3 @@ -const fs = require('fs'); const path = require('path'); const userConfig = require('../../config'); @@ -15,7 +14,7 @@ delete require.cache[require.resolve('../../shared/config/paths')]; // Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. // https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 // We also resolve them to make sure all tools using them work consistently. -const appDirectory = fs.realpathSync(process.cwd()); +const appDirectory = path.resolve(path.join(__dirname, '../..')); process.env.NODE_PATH = (process.env.NODE_PATH || '') .split(path.delimiter) .filter((folder) => folder && !path.isAbsolute(folder)) diff --git a/shared/config/paths.js b/shared/config/paths.js index 9d914fd1..46bffc50 100644 --- a/shared/config/paths.js +++ b/shared/config/paths.js @@ -4,7 +4,7 @@ const userConfig = require('../../config'); // Make sure any symlinks in the project folder are resolved: // https://github.com/facebookincubator/create-react-app/issues/637 -const appDirectory = fs.realpathSync(process.cwd()); +const appDirectory = path.resolve(path.join(__dirname, '../..')); const resolveApp = (relativePath) => path.resolve(appDirectory, relativePath); const ensureSlash = (questionablePath, needsSlash) => { const hasSlash = questionablePath.endsWith('/');