You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tldr; Changing publicPath from / to /whatever/ breaks %PUBLIC_HTML% replacement:
diff --git a/packages/react-scripts/config/webpackDevServer.config.js b/packages/react-scripts/config/webpackDevServer.config.js
index 2a2128e..f0f14b8 100644
--- a/packages/react-scripts/config/webpackDevServer.config.js+++ b/packages/react-scripts/config/webpackDevServer.config.js@@ -72,7 +72,7 @@ module.exports = function(proxy, allowedHost) {
// ❌ /whatever/static/js/bundle.js doesn't work
// ✅ /static/js/bundle.js still does
// 🤔 Changing this to /whatever prevents %PUBLIC_URL% from being replaced!?
- publicPath: '/',+ publicPath: '/whatever/',
// WebpackDevServer is noisy by default so we emit custom message instead
// by listening to the compiler events with `compiler.hooks[...].tap` calls above.
quiet: true,
Current behaviour
The HTML remains untouched:
<!DOCTYPE html><htmllang="en"><head><metacharset="utf-8" /><linkrel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" /><metaname="viewport"
content="width=device-width, initial-scale=1, shrink-to-fit=no"
/><metaname="theme-color" content="#000000" /><!-- manifest.json provides metadata used when your web app is added to the homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/ --><linkrel="manifest" href="%PUBLIC_URL%/manifest.json" /><!-- Notice the use of %PUBLIC_URL% in the tags above. It will be replaced with the URL of the `public` folder during the build. Only files inside the `public` folder can be referenced from the HTML. Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --><title>React App</title></head><body><noscript>You need to enable JavaScript to run this app.</noscript><divid="root"></div><!-- This HTML file is a template. If you open it directly in the browser, you will see an empty page. You can add webfonts, meta tags, or analytics to this file. The build step will place the bundled scripts into the <body> tag. To begin the development, run `npm start` or `yarn start`. To create a production bundle, use `npm run build` or `yarn build`. --></body></html>
(Whereas with publicPath: "/" in the webpack-dev-server, %PUBLIC_URL% is replaced correctly! Although the files aren't served because the public path should be /whatever/)
Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:
I having troubles to find out how I could reproduce this bug.
Could you please try to create a minimal reproduction example (especially remove all dependencies, loaders and plugins which are not necessary for reproduction) and attach it (with out node_modules) as a zip to this issue?
The html-webpack-plugin doesn't replace %PUBLIC_HTML%. Could you please explain why you believe the bug might be part of the html-webpack-plugin?
Expected behaviour
I opened a bug for facebook/create-react-app#6280, but upon review I'm thinking the issue is more with this plugin.
tldr; Changing
publicPath
from/
to/whatever/
breaks%PUBLIC_HTML%
replacement:Current behaviour
The HTML remains untouched:
(Whereas with
publicPath: "/"
in the webpack-dev-server,%PUBLIC_URL%
is replaced correctly! Although the files aren't served because the public path should be/whatever/
)Environment
Tell us which operating system you are using, as well as which versions of Node.js, npm, webpack, and html-webpack-plugin. Run the following to get it quickly:
Config
See facebook/create-react-app#6280 to reproduce
Relevant Links
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: