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,