Closed
Description
Describe the bug
When I add git information to package.json
, it somehow gets added to PUBLIC_URL, so that the built html has bad references like <link href="/sw-yx/hi/static/css/main.5f361e03.chunk.css" rel="stylesheet" />
and <link rel="icon" href="/sw-yx/h/favicon.ico" />
(which is even worse!!!).
i think this is a bug.
Did you try recovering your dependencies?
yarn 1.22.4
Which terms did you search for in User Guide?
PUBLIC_URL, prefix
Environment
Environment Info:
current version of create-react-app: 3.4.1
running from /Users/wanshawn/.npm/_npx/78798/lib/node_modules/create-react-app
System:
OS: macOS Mojave 10.14.6
CPU: (8) x64 Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
Binaries:
Node: 12.18.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.7 - /usr/local/bin/npm
Browsers:
Chrome: 84.0.4147.135
Firefox: 68.8.0
Safari: 13.1.2
npmPackages:
react: ^16.13.1 => 16.13.1
react-dom: ^16.13.1 => 16.13.1
react-scripts: 3.4.3 => 3.4.3
npmGlobalPackages:
create-react-app: Not Found
Steps to reproduce
npm create react-app
gh create repo
npm init -y
<- this adds repo details topackage.json
yarn build
when you check build/index.html
, you find the bug:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="/sw-yx/h/favicon.ico" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="/sw-yx/h/logo192.png" />
<link rel="manifest" href="/sw-yx/h/manifest.json" />
<title>React App</title>
<link
href="/sw-yx/hi/static/css/main.5f361e03.chunk.css"
rel="stylesheet"
/>
</head>
The bug is that /sw-yx/hi
is inserted as PUBLIC_URL
where it should not be, and even worse, in parts of it the last letter is snipped off.
Expected behavior
nothing in package.json should impact what PUBLIC_URL is