Skip to content

Conversation

@rebeccaalpert
Copy link
Member

@rebeccaalpert rebeccaalpert commented Nov 13, 2025

Red Hat Developer Hub needs a smaller bundle size. Checking with Karthik to see if lazy loading/peer dep changes work - Backstage doesn't have webpack plugin configuration and neither do we. Backstage uses Webpack under the hood in a non-accessible way, so it may pick this up and reduce the bundle size.

Am interested to know if they can also try using React.lazy/Suspense when loading the Code Modal - it may be that Backstage is able to optimize if that is done, but I am unsure.

Does add a loading state if the third-party dependency needs a moment.

Will also see if Joachim has ideas.

@patternfly-build
Copy link

patternfly-build commented Nov 13, 2025

@karthikjeeyar
Copy link
Contributor

Verified the fix in RHDH, lazy loading and having it as a peer-dependancy works. RHDH installer doesn't throw the bundle size issue anymore.

image

@rebeccaalpert
Copy link
Member Author

Just renaming commit to be something compatible with automatic release - no code changes.

@rebeccaalpert rebeccaalpert changed the title Trying to fix RHDH Monaco size issue fix(CodeModal): Switch over to lazy loading Monaco Nov 14, 2025
Copy link
Contributor

@jschuler jschuler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great apart from a minor comment!

"react": "^18 || ^19",
"react-dom": "^18 || ^19"
"react-dom": "^18 || ^19",
"monaco-editor": "^0.54.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should probably also list @monaco-editor/react here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All set; thank you!

Red Hat Developer Hub needs a smaller bundle size. They and we are unable to use Webpack plugins directly, so this is a solution that works independently of the Monaco Webpack plugin. Does add a loading state if the third-party dependency needs a moment. Consumers will need to add their own peer dependencies for monaco-editor and @monaco-editor/react.
@rebeccaalpert rebeccaalpert merged commit 9493639 into patternfly:main Nov 18, 2025
10 of 11 checks passed
@github-actions
Copy link

🎉 This PR is included in version 6.5.0-prerelease.19 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monaco-editor import increases the bundle size

5 participants