From e28e12bd67191234a8fc5ded5e857623c8266eb0 Mon Sep 17 00:00:00 2001 From: Leo McArdle Date: Tue, 14 May 2024 12:01:30 +0000 Subject: [PATCH] chore(webpack): remove remnants of PUBLIC_URL and hard code --- client/config/env.js | 9 +++------ client/config/paths.js | 17 ----------------- client/config/webpack.config.js | 16 ++-------------- client/config/webpackDevServer.config.js | 10 ---------- client/src/react-app.d.ts | 1 - package.json | 2 +- server/react-app.d.ts | 1 - ssr/react-app.d.ts | 1 - 8 files changed, 6 insertions(+), 51 deletions(-) diff --git a/client/config/env.js b/client/config/env.js index 55c69255c1d1..f72dd0b14294 100644 --- a/client/config/env.js +++ b/client/config/env.js @@ -40,7 +40,7 @@ process.env.NODE_PATH = (process.env.NODE_PATH || "") // injected into the application via DefinePlugin in webpack configuration. const REACT_APP = /^REACT_APP_/i; -function getClientEnvironment(publicUrl) { +function getClientEnvironment() { const raw = Object.keys(process.env) .filter((key) => REACT_APP.test(key)) .reduce( @@ -52,11 +52,8 @@ function getClientEnvironment(publicUrl) { // Useful for determining whether we’re running in production mode. // Most importantly, it switches React into the correct mode. NODE_ENV: process.env.NODE_ENV || "development", - // Useful for resolving the correct path to static assets in `public`. - // For example, . - // This should only be used as an escape hatch. Normally you would put - // images into the `src` and `import` them in code to get their paths. - PUBLIC_URL: publicUrl, + // TODO: Can't remove yet as it makes the build differ, remove later + PUBLIC_URL: "", // We support configuring the sockjs pathname during development. // These settings let a developer run multiple simultaneous projects. // They are used as the connection `hostname`, `pathname` and `port` diff --git a/client/config/paths.js b/client/config/paths.js index 37ee9d40188d..04d8a6a1ce74 100644 --- a/client/config/paths.js +++ b/client/config/paths.js @@ -1,6 +1,4 @@ -import fs from "node:fs"; import { fileURLToPath } from "node:url"; -import getPublicUrlOrPath from "react-dev-utils/getPublicUrlOrPath.js"; // Make sure any symlinks in the project folder are resolved: // https://github.com/facebook/create-react-app/issues/637 @@ -8,20 +6,6 @@ const appDirectory = new URL("..", import.meta.url); const resolveApp = (relativePath) => fileURLToPath(new URL(relativePath, appDirectory)); -const appPackage = JSON.parse(fs.readFileSync(resolveApp("package.json"))); - -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// webpack needs to know it to put the right