From ce0b92ba73072c0f0143829a53f870155ad4c7ff Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 20 Sep 2022 18:36:58 +0200 Subject: [PATCH] update cloudflare esbuild config (fixing solid ssr) (#4815) * fixing esbuild platform setting, to enable solid build * added changeset * changed change to major Co-authored-by: AirBorne04 --- .changeset/new-ties-change.md | 5 +++++ packages/integrations/cloudflare/src/index.ts | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 .changeset/new-ties-change.md diff --git a/.changeset/new-ties-change.md b/.changeset/new-ties-change.md new file mode 100644 index 000000000000..565934411f32 --- /dev/null +++ b/.changeset/new-ties-change.md @@ -0,0 +1,5 @@ +--- +'@astrojs/cloudflare': major +--- + +adjusted esbuild config to work with worker environment (fixing solid js ssr) diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts index e207bdb44b16..357f8a0640f4 100644 --- a/packages/integrations/cloudflare/src/index.ts +++ b/packages/integrations/cloudflare/src/index.ts @@ -67,8 +67,8 @@ export default function createIntegration(args?: Options): AstroIntegration { } vite.ssr = { - target: 'webworker', - noExternal: true, + ...vite.ssr, + target: 'webworker' }; } }, @@ -77,7 +77,9 @@ export default function createIntegration(args?: Options): AstroIntegration { const pkg = fileURLToPath(entryUrl); await esbuild.build({ target: 'es2020', - platform: 'browser', + platform: 'neutral', + mainFields: ['main', 'module'], + conditions: ['worker', 'node'], entryPoints: [pkg], outfile: pkg, allowOverwrite: true,