preact-cli icon indicating copy to clipboard operation
preact-cli copied to clipboard

Enable regenerator in legacy bundles

Open developit opened this issue 2 years ago • 5 comments

What kind of change does this PR introduce?

Transpiles generators to regenerator in legacy bundles.

Summary

In 3.3.0, we stopped using fast-async to transpile async functions, however this meant they were transpiled to generators, which we don't transpile at all. The modern bundles should be unaffected by all of these changes, so let's enable regenerator to handle both async and generator functions in legacy bundles.

Does this PR introduce a breaking change?

No, it fixes an unintentionally-breaking change.

developit avatar Nov 18 '21 16:11 developit

🦋 Changeset detected

Latest commit: dcf6a21daf428ba2cc6868e9155dbdfa96e5d8f3

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

This PR includes changesets to release 1 package
Name Type
preact-cli 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

changeset-bot[bot] avatar Nov 18 '21 16:11 changeset-bot[bot]

Not sure how I managed to make the Service Worker tests fail with this PR.

developit avatar Nov 18 '21 18:11 developit

Seems both service workers (esm and legacy) are having regenerator inserted in. I imagine they should be excluded?

rschristian avatar Nov 19 '21 00:11 rschristian

@rschristian I was thinking that was the case, yeah. Neither should have it, or at least the modern one shouldn't have it (the legacy sw file never gets used, no browsers support SW that don't also support ESM).

developit avatar Nov 19 '21 01:11 developit

Darn, function Use entries are only supported as of Webpack 4

developit avatar Nov 19 '21 16:11 developit