Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add UMD builds backs in the core #3390

Merged
merged 2 commits into from
Jun 8, 2022
Merged

Add UMD builds backs in the core #3390

merged 2 commits into from
Jun 8, 2022

Conversation

Andarist
Copy link
Member

@Andarist Andarist commented Jun 8, 2022

I'm not a fan of shipping those in 2022 but this has been asked on Discord. I don't want to work too much on those bundles because I think that if somebody needs those then they need to figure out creating those on their end (it's not that hard and we won't have a lot of consumers for those bundles nowadays).

The main problem with them for us is that Rollup doesn't support code-splitting for such targets:

Error: Invalid value "umd" for option "output.format" - UMD and IIFE output formats are not supported for code-splitting builds.

This can easily be checked on their playground

So since code-splitting isnt' supported we have to bundle all of the entrypoints separately and that might cause issues with shared state, instanceof and similar.

Alternatively we could prepare special "all at once" UMD bundles but... that would complicate our setup and would have rather poor RoI given how niche those bundles are nowadays.

I'm kinda providing those here with a disclaimer that YMMV. I didn't test them in full and stuff might not work properly.

@changeset-bot
Copy link

changeset-bot bot commented Jun 8, 2022

🦋 Changeset detected

Latest commit: 8da759c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
xstate Patch

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 8, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 8da759c:

Sandbox Source
XState Example Template Configuration
XState React Template Configuration

@ghost
Copy link

ghost commented Jun 8, 2022

👇 Click on the image for a new way to code review
  • Make big changes easier — review code in small groups of related files

  • Know where to start — see the whole change at a glance

  • Take a code tour — explore the change with an interactive tour

  • Make comments and review — all fully sync’ed with github

    Try it now!

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map Legend

@@ -1,4 +0,0 @@
{
Copy link
Member Author

Choose a reason for hiding this comment

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

We've missed this in #3187

@Andarist Andarist merged commit 7abc417 into next Jun 8, 2022
@Andarist Andarist deleted the andarist/fix-umd-builds branch June 8, 2022 12:24
@Andarist
Copy link
Member Author

Andarist commented Jun 6, 2023

I'm leaning toward reverting this. UMDs are a weird beast of the past. In today's landscape, you can either use a bundler-powered CDN like Skypack or you can find the ESM files in our packages that are compatible with browsers.

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