Skip to content

Conversation

gribnoysup
Copy link
Collaborator

@gribnoysup gribnoysup commented Oct 8, 2025

We're planning to switch mms to load compass-web from external cdn instead of having it bundled with the whole mms application, first step into that direction is to switch compass-web distribution to be a native esm module instead of a cjs one. This change is fully backwards compatible with how the compass-web library is being consumed by mms right now This is a breaking change in how compass-web get embedded in the consumer app, but it can be done in safe, backwards compatible way where the the old compass-web is still working, while we do the prep work for the new version to be included

* runtime exports not being built correctly. We should investigate and try to
* fix this to remove this custom chunk splitting logic.
*/
function createSiblingBundleFromLeafDeps(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Another benefit of this is that we don't need custom split chunk logic anymore

@gribnoysup gribnoysup marked this pull request as ready for review October 9, 2025 08:28
@gribnoysup gribnoysup requested a review from a team as a code owner October 9, 2025 08:28
@gribnoysup gribnoysup requested a review from mabaasit October 9, 2025 08:28
@gribnoysup gribnoysup changed the title chore(web): change web build to produce esm instead of cjs chore(web): change web build to produce esm instead of cjs COMPASS-9934 Oct 9, 2025
externals: {
react: 'commonjs2 react',
'react-dom': 'commonjs2 react-dom',
react: ['__compassWebSharedRuntime', 'React'],
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does __compassWebSharedRuntime work here? Does it mean that React would be accessible from window.__compassWebSharedRuntime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes! Actually I'm wrong in saying that is it fully backwards compatible, I updated the PR description. I'll open an mms PR is a sec to illustrate

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Opened https://github.com/10gen/mms/pull/143845 that shows how this will work

Copy link
Collaborator

Choose a reason for hiding this comment

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

Now it makes sense to me. Looks nice, thanks.
[nit]: can you add a comment so that someone does not change it unintentionally?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants