From 45a7bd4e1e0df330f5c6a205ddb2eaa194b49d27 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 18 Nov 2021 11:27:09 -0500 Subject: [PATCH 1/7] Enable regenerator in legacy bundles --- packages/cli/lib/lib/babel-config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cli/lib/lib/babel-config.js b/packages/cli/lib/lib/babel-config.js index df2bb1a90..e331326f7 100644 --- a/packages/cli/lib/lib/babel-config.js +++ b/packages/cli/lib/lib/babel-config.js @@ -10,8 +10,7 @@ module.exports = function (env, options = {}) { modules: options.modules || false, targets: { browsers: options.browsers, - }, - exclude: ['transform-regenerator'], + } }, ], ], From 1ec2da9dbbef13db0825ad2e9b42eeac6f3c0c54 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 18 Nov 2021 11:30:52 -0500 Subject: [PATCH 2/7] Create fresh-paws-argue.md --- .changeset/fresh-paws-argue.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fresh-paws-argue.md diff --git a/.changeset/fresh-paws-argue.md b/.changeset/fresh-paws-argue.md new file mode 100644 index 000000000..04d1c506e --- /dev/null +++ b/.changeset/fresh-paws-argue.md @@ -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. From e54fe1e767fcc67b69c4da036741a674d63ddb2b Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 18 Nov 2021 12:19:19 -0500 Subject: [PATCH 3/7] Compile SSR bundle for maintained Node versions --- packages/cli/lib/lib/webpack/webpack-base-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/lib/lib/webpack/webpack-base-config.js b/packages/cli/lib/lib/webpack/webpack-base-config.js index 62990de94..5376d93e1 100644 --- a/packages/cli/lib/lib/webpack/webpack-base-config.js +++ b/packages/cli/lib/lib/webpack/webpack-base-config.js @@ -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; From 231a579144afe4cf5696a97c6e04ee998cac2582 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 18 Nov 2021 12:20:10 -0500 Subject: [PATCH 4/7] Update webpack-base-config.js --- packages/cli/lib/lib/webpack/webpack-base-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/lib/lib/webpack/webpack-base-config.js b/packages/cli/lib/lib/webpack/webpack-base-config.js index 5376d93e1..833b5910a 100644 --- a/packages/cli/lib/lib/webpack/webpack-base-config.js +++ b/packages/cli/lib/lib/webpack/webpack-base-config.js @@ -86,7 +86,7 @@ module.exports = function createBaseConfig(env) { const browserslistDefaults = ['> 0.25%', 'IE >= 9']; const browserlistConfig = Object(browserslist.findConfig(cwd)); const browsers = - env.browserslist || + env.browserslist || (isProd ? browserlistConfig.production : browserlistConfig.development) || browserlistConfig.defaults || browserslistDefaults; From 1ec8f241c31dd2e779117f304dcd2d794a593cc1 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 18 Nov 2021 12:21:18 -0500 Subject: [PATCH 5/7] Compile SSR bundle for maintained Node versions --- packages/cli/lib/lib/webpack/webpack-server-config.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/cli/lib/lib/webpack/webpack-server-config.js b/packages/cli/lib/lib/webpack/webpack-server-config.js index dcbfa34dc..2b4ba1169 100644 --- a/packages/cli/lib/lib/webpack/webpack-server-config.js +++ b/packages/cli/lib/lib/webpack/webpack-server-config.js @@ -27,5 +27,6 @@ function serverConfig(env) { } module.exports = function createServerConfig(env) { + env = Object.assign({}, env, { browserslist: 'maintained node versions' }); return merge(baseConfig(env), serverConfig(env)); }; From 2e18aae1dc1586cc9cd402acd5ea48245404884a Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Thu, 18 Nov 2021 12:39:55 -0500 Subject: [PATCH 6/7] Update webpack-server-config.js --- packages/cli/lib/lib/webpack/webpack-server-config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/cli/lib/lib/webpack/webpack-server-config.js b/packages/cli/lib/lib/webpack/webpack-server-config.js index 2b4ba1169..057c237b3 100644 --- a/packages/cli/lib/lib/webpack/webpack-server-config.js +++ b/packages/cli/lib/lib/webpack/webpack-server-config.js @@ -27,6 +27,6 @@ function serverConfig(env) { } module.exports = function createServerConfig(env) { - env = Object.assign({}, env, { browserslist: 'maintained node versions' }); + env = Object.assign({}, env, { browserslist: 'node >= 12' }); return merge(baseConfig(env), serverConfig(env)); }; From 10e234e4989588c9aa7032d6c21237488ac3af98 Mon Sep 17 00:00:00 2001 From: Jason Miller Date: Fri, 19 Nov 2021 10:49:57 -0500 Subject: [PATCH 7/7] Attempt to prevent regenerator compilation in SW --- packages/cli/lib/lib/webpack/webpack-base-config.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/cli/lib/lib/webpack/webpack-base-config.js b/packages/cli/lib/lib/webpack/webpack-base-config.js index 833b5910a..929b75cad 100644 --- a/packages/cli/lib/lib/webpack/webpack-base-config.js +++ b/packages/cli/lib/lib/webpack/webpack-base-config.js @@ -174,7 +174,7 @@ module.exports = function createBaseConfig(env) { module: { rules: [ - { + (info) => ({ // ES2015 enforce: 'pre', test: /\.m?[jt]sx?$/, @@ -183,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' + ? 'supports es6-module' + : browsers + }), babelrc // intentionally overwrite our settings ), - }, + }), { // LESS enforce: 'pre',