Skip to content

Commit

Permalink
adjusting cloudflare adapter and solid ssr to work together (#4888)
Browse files Browse the repository at this point in the history
* adjusting cloudflare adapter (respecting user config)
define better solid ssr config

* only inline the framework

this needs to happen for worker build in order to have the correct build mode for the framework, which needs the nodejs no matter if it is for node or the browser.

Co-authored-by: AirBorne04 <[email protected]>
  • Loading branch information
AirBorne04 and AirBorne04 authored Oct 6, 2022
1 parent 35fe8e8 commit 198fa7d
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions packages/integrations/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,16 @@ export default function createIntegration(args?: Options): AstroIntegration {
(vite.resolve.alias as Record<string, string>)[alias.find] = alias.replacement;
}
}

vite.ssr = {
...vite.ssr,
target: 'webworker',
};
vite.ssr = vite.ssr || {};
vite.ssr.target = vite.ssr.target || 'webworker';
}
},
'astro:build:done': async () => {
const entryUrl = new URL(_buildConfig.serverEntry, _buildConfig.server);
const pkg = fileURLToPath(entryUrl);
await esbuild.build({
target: 'es2020',
platform: 'neutral',
mainFields: ['main', 'module'],
conditions: ['worker', 'node'],
platform: 'browser',
entryPoints: [pkg],
outfile: pkg,
allowOverwrite: true,
Expand Down

0 comments on commit 198fa7d

Please sign in to comment.