flood: do not use current working path to retrieve assets

This commit is contained in:
Jesse Chan
2020-08-25 19:31:41 +08:00
parent ba25189af0
commit 68b7b04773
2 changed files with 2 additions and 3 deletions
+1 -2
View File
@@ -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))
+1 -1
View File
@@ -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('/');