Skip to content
This repository has been archived by the owner on Feb 10, 2025. It is now read-only.

Commit

Permalink
Remove internal vue handling in cloudflare integration (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy authored Jan 17, 2025
1 parent 7b352ee commit ce66003
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/metal-shirts-bake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/cloudflare': patch
---

Removes internal `vue` handling
14 changes: 0 additions & 14 deletions packages/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,27 +243,13 @@ export default function createIntegration(args?: Options): AstroIntegration {
vite.ssr.target = 'webworker';
vite.ssr.noExternal = true;

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 ||= {};
vite.build.rollupOptions.output ||= {};
// @ts-expect-error
vite.build.rollupOptions.output.banner ||=
'globalThis.process ??= {}; globalThis.process.env ??= {};';

vite.build.rollupOptions.external = _config.vite.build?.rollupOptions?.external ?? [];

// Cloudflare env is only available per request. This isn't feasible for code that access env vars
// in a global way, so we shim their access as `process.env.*`. This is not the recommended way for users to access environment variables. But we'll add this for compatibility for chosen variables. Mainly to support `@astrojs/db`
vite.define = {
Expand Down

0 comments on commit ce66003

Please sign in to comment.