Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjusting cloudflare adapter and solid ssr to work together #4888

Merged
merged 10 commits into from
Oct 6, 2022
7 changes: 7 additions & 0 deletions .changeset/cuddly-clouds-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/cloudflare': major
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this only fixes bugs then this shouldn't be a major. Maybe you were just being conservation here, or can you tell me what this breaks?

If this is a true breaking change I think we should have more explanation of the change in the changeset.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted this one to minor

'@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)
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';
AirBorne04 marked this conversation as resolved.
Show resolved Hide resolved
}
},
'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',
AirBorne04 marked this conversation as resolved.
Show resolved Hide resolved
entryPoints: [pkg],
outfile: pkg,
allowOverwrite: true,
Expand Down
2 changes: 2 additions & 0 deletions packages/integrations/solid/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ function getViteConfiguration(isDev: boolean) {
},
ssr: {
external: ['babel-preset-solid'],
target: 'node',
AirBorne04 marked this conversation as resolved.
Show resolved Hide resolved
noExternal: true
matthewp marked this conversation as resolved.
Show resolved Hide resolved
},
};
}
Expand Down