-
-
Notifications
You must be signed in to change notification settings - Fork 375
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
Enable regenerator in legacy bundles #1617
base: master
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: dcf6a21 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Not sure how I managed to make the Service Worker tests fail with this PR. |
Seems both service workers (esm and legacy) are having regenerator inserted in. I imagine they should be excluded? |
@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). |
Darn, function |
@@ -182,10 +183,14 @@ module.exports = function createBaseConfig(env) { | |||
loader: require.resolve('babel-loader'), | |||
options: Object.assign( | |||
{ babelrc: false }, | |||
createBabelConfig(env, { browsers }), | |||
createBabelConfig(env, { | |||
browsers: info.compiler.name === 'InjectManifest' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what exactly does this do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supposed to keep modern syntax in both generated sw.js
outputs, since service worker is only supported by fairly modern browsers with generator/async support anyway. The compiler.name
check is looking for the child compiler created by the workbox-webpack-plugin
InjectManfiest
plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it would make sense to add a comment for future reference
@@ -173,7 +174,7 @@ module.exports = function createBaseConfig(env) { | |||
|
|||
module: { | |||
rules: [ | |||
{ | |||
(info) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests seem to be failing because this is a function
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this only supported in newer Webpack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, isn't supported in newer Webpack either. Rules have to be objects.
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.