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

Remove internal vue handling in cloudflare integration #506

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 ?? [];
Copy link
Member Author

Choose a reason for hiding this comment

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

I removed this, and similarly for the vite.ssr.external handling that was in #210, as I don't think this line really affects anything. The default undefined setting is already an empty array.


// 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
Loading