-
-
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?
Changes from all commits
45a7bd4
1ec2da9
e54fe1e
231a579
1ec8f24
2e18aae
10e234e
dcf6a21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"preact-cli": patch | ||
--- | ||
|
||
Transpile generators and async functions in legacy bundles. Async functions were inadvertently transpiled to generators in 3.3.0, this transpiles them to ES5. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ module.exports = function createBaseConfig(env) { | |
const browserslistDefaults = ['> 0.25%', 'IE >= 9']; | ||
const browserlistConfig = Object(browserslist.findConfig(cwd)); | ||
const browsers = | ||
env.browserslist || | ||
(isProd ? browserlistConfig.production : browserlistConfig.development) || | ||
browserlistConfig.defaults || | ||
browserslistDefaults; | ||
|
@@ -173,7 +174,7 @@ module.exports = function createBaseConfig(env) { | |
|
||
module: { | ||
rules: [ | ||
{ | ||
(info) => ({ | ||
// ES2015 | ||
enforce: 'pre', | ||
test: /\.m?[jt]sx?$/, | ||
|
@@ -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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. It's supposed to keep modern syntax in both generated There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. maybe it would make sense to add a comment for future reference |
||
? 'supports es6-module' | ||
: browsers | ||
}), | ||
babelrc // intentionally overwrite our settings | ||
), | ||
}, | ||
}), | ||
{ | ||
// LESS | ||
enforce: 'pre', | ||
|
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.