From c3572fd5e0e3864cd728f83502a52e9274793ee2 Mon Sep 17 00:00:00 2001 From: Dario Piotrowicz Date: Thu, 28 Sep 2023 19:56:01 +0100 Subject: [PATCH] fix(cloudflare): target es2022 instead of es2020 to fix esbuild incompatibility issues (#8682) * fix(cloudflare): target es2022 instead of es2020 to fix esbuild incompatibility issues * add changeset * update changeset * fix(cloudflare): change build target to es2022 --------- Co-authored-by: Alexander Niebuhr --- .changeset/orange-windows-battle.md | 5 +++++ packages/integrations/cloudflare/src/index.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/orange-windows-battle.md diff --git a/.changeset/orange-windows-battle.md b/.changeset/orange-windows-battle.md new file mode 100644 index 000000000000..37fcb28fabc0 --- /dev/null +++ b/.changeset/orange-windows-battle.md @@ -0,0 +1,5 @@ +--- +'@astrojs/cloudflare': minor +--- + +Change build target from `es2020` to `es2022`, for better support diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts index 12ff00a54b04..e0f055612c0e 100644 --- a/packages/integrations/cloudflare/src/index.ts +++ b/packages/integrations/cloudflare/src/index.ts @@ -232,7 +232,7 @@ export default function createIntegration(args?: Options): AstroIntegration { fileURLToPath(assetsUrl) ); await esbuild.build({ - target: 'es2020', + target: 'es2022', platform: 'browser', conditions: ['workerd', 'worker', 'browser'], external: [ @@ -313,7 +313,7 @@ export default function createIntegration(args?: Options): AstroIntegration { const finalBuildUrl = pathToFileURL(buildPath.replace(/\.mjs$/, '.js')); await esbuild.build({ - target: 'es2020', + target: 'es2022', platform: 'browser', conditions: ['workerd', 'worker', 'browser'], external: [