adjusting cloudflare adapter and solid ssr to work together (#4888)
* 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 <daniel@floatingpixels.com>
This commit is contained in:
parent
e5b526c3a5
commit
2dc582ac5e
3 changed files with 12 additions and 8 deletions
7
.changeset/cuddly-clouds-complain.md
Normal file
7
.changeset/cuddly-clouds-complain.md
Normal file
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
'@astrojs/cloudflare': major
|
||||
'@astrojs/solid-js': patch
|
||||
---
|
||||
|
||||
adjusting the build settings for cloudflare (reverting back to platform browser over neutral)
|
||||
adjusting the ssr settings for solidjs (to build for node)
|
|
@ -65,11 +65,8 @@ 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 () => {
|
||||
|
@ -77,9 +74,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
|||
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,
|
||||
|
|
|
@ -44,6 +44,8 @@ function getViteConfiguration(isDev: boolean) {
|
|||
},
|
||||
ssr: {
|
||||
external: ['babel-preset-solid'],
|
||||
target: 'node',
|
||||
noExternal: ['solid-js']
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue