[AFBH-1740] : Normalize public URL handling in dev server#951
[AFBH-1740] : Normalize public URL handling in dev server#951SravanKumar2305 wants to merge 1 commit intoatlassian-labs:mainfrom
Conversation
|
Thank you for your submission! Like many open source projects, we ask that you sign our CLA (Contributor License Agreement) before we can accept your contribution. Already signed the CLA? To re-check, try refreshing the page. |
🦋 Changeset detectedLatest commit: 81cc853 The changes in this PR will be included in the next version bump. This PR includes changesets to release 112 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
marcins
left a comment
There was a problem hiding this comment.
As mentioned in Slack - my main concern is that there might intentionally be a base URL without a trailing slash somewhere, but this is less likely for our internal use case (FWIW Webpack/rspack for example don't append a / - I've fallen for that before!).
Motivation
The dev server currently allows
publicUrlvalues without trailing slashes (e.g.,http://localhost:8080or/assets), which can result in malformed asset URLs likelocalhost:8080assets.jsoninstead oflocalhost:8080/assets.json. This leads to broken asset loading in the development environment.Changes
normalizePublicUrlTrailingSlashthat automatically appends a trailing slash topublicUrlvalues in the dev server when enabled/assets) and full URLs (e.g.,http://localhost:8080)packages/core/cli/src/normalizeOptions.tsandpackages/core/feature-flags/src/index.tsChecklist
Changeset :
This change adds a new feature flag
normalizePublicUrlTrailingSlashthat, when enabled, automatically adds a trailing slash topublicUrlvalues in the dev server. This prevents issues where URLs without trailing slashes (e.g.,http://localhost:8080or/assets) could result in malformed asset URLs likelocalhost:8080assets.jsoninstead oflocalhost:8080/assets.json.The feature flag is disabled by default to maintain backward compatibility. Enable it with: