summaryrefslogtreecommitdiff
path: root/packages/integrations/cloudflare/src
diff options
context:
space:
mode:
authorGravatar Alexander Niebuhr <alexander@nbhr.io> 2024-03-29 12:40:03 +0100
committerGravatar GitHub <noreply@github.com> 2024-03-29 12:40:03 +0100
commit2031f63a552c6e288d9ac6e8792a5a2f9bba04bb (patch)
treec69501d4aabaca654e77006230d8f2dd30c4b1e6 /packages/integrations/cloudflare/src
parent5cd80b0d30d996477f9d5e1f63a87c029099e9ff (diff)
downloadastro-2031f63a552c6e288d9ac6e8792a5a2f9bba04bb.tar.gz
astro-2031f63a552c6e288d9ac6e8792a5a2f9bba04bb.tar.zst
astro-2031f63a552c6e288d9ac6e8792a5a2f9bba04bb.zip
fix(cloudflare): using vue breaks builds (#210)
Co-authored-by: Emanuele Stoppa <602478+ematipico@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/cloudflare/src')
-rw-r--r--packages/integrations/cloudflare/src/index.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts
index 1427dc938..7b57b9621 100644
--- a/packages/integrations/cloudflare/src/index.ts
+++ b/packages/integrations/cloudflare/src/index.ts
@@ -173,7 +173,18 @@ export default function createIntegration(args?: Options): AstroIntegration {
vite.ssr ||= {};
vite.ssr.target = 'webworker';
vite.ssr.noExternal = true;
- vite.ssr.external = _config.vite.ssr?.external ?? [];
+
+ if (typeof _config.vite.ssr?.external === 'undefined') vite.ssr.external = [];
+ if (typeof _config.vite.ssr?.external === 'boolean')
+ vite.ssr.external = _config.vite.ssr?.external;
+ if (Array.isArray(_config.vite.ssr?.external))
+ // `@astrojs/vue` sets `@vue/server-renderer` to external
+ // https://github.com/withastro/astro/blob/e648c5575a8774af739231cfa9fc27a32086aa5f/packages/integrations/vue/src/index.ts#L119
+ // the cloudflare adapter needs to get all dependencies inlined, we use `noExternal` for that, but any `external` config overrides that
+ // therefore we need to remove `@vue/server-renderer` from the external config again
+ vite.ssr.external = _config.vite.ssr?.external.filter(
+ (entry) => entry !== '@vue/server-renderer'
+ );
vite.build ||= {};
vite.build.rollupOptions ||= {};