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

Enable regenerator in legacy bundles #1617

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fresh-paws-argue.md
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.
3 changes: 1 addition & 2 deletions packages/cli/lib/lib/babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ module.exports = function (env, options = {}) {
modules: options.modules || false,
targets: {
browsers: options.browsers,
},
exclude: ['transform-regenerator'],
}
},
],
],
Expand Down
1 change: 1 addition & 0 deletions packages/cli/lib/lib/webpack/webpack-base-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/cli/lib/lib/webpack/webpack-server-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,6 @@ function serverConfig(env) {
}

module.exports = function createServerConfig(env) {
env = Object.assign({}, env, { browserslist: 'node >= 12' });
return merge(baseConfig(env), serverConfig(env));
};