Repository navigation
Conversation
The splash screen renders PACKAGE_VERSION directly since swagger-api#5874, but only the dev server and app configs passed buildDefines() to Vite. The ESM and UMD bundles shipped the bare identifier, so rendering the splash screen threw a ReferenceError and the editor never mounted. Closes swagger-api#5893
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5893. Thanks @jem3523 for the detailed report and the bisect.
Since #5874 the splash screen renders
PACKAGE_VERSIONdirectly, and the versions plugin readsPACKAGE_VERSION,GIT_COMMIT,GIT_DIRTYandBUILD_TIME. Onlyvite.config.jsandvite.config.app.jspassbuildDefines()to Vite, so the library bundles keep the bare identifiers. Rendering the splash screen then throwsReferenceError: PACKAGE_VERSION is not definedand the editor never mounts.The issue reports this for the UMD bundle, but the ESM bundle has the same problem:
dist/esm/plugins/splash-screen/index.jsin the published 5.9.0 package containschildren: PACKAGE_VERSION. Consumers who import the ESM build hit the same error unless their own bundler defines the constant.This change adds
define: buildDefines()to the main config invite.config.esm.jsandvite.config.umd.js, matching the other two configs.How I checked it (there is no unit test harness for the build configs, and CI doesn't build the bundles):
npm run build:bundle:umdandnpm run build:bundle:esmonmainboth output an unsubstitutedPACKAGE_VERSIONin the splash screen. With this change the UMD bundle haschildren:`5.9.0`anddist/esmno longer contains any of the four identifiers outside source maps.SplashScreencomponent from the builtdist/esm/plugins/splash-screen/index.jswithreact-dom/server. Onmainit throwsReferenceError: PACKAGE_VERSION is not defined. With this change it renders<figcaption>5.9.0</figcaption>.npx eslintandprettier --checkpass on both changed files, andnpm run test:runpasses.This does not cover #5894 (
require is not definedin the UMD bundle), which is a separate problem.Replaces #5907, which got closed when my fork was accidentally detached.