Skip to content
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/funny-planes-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/cloudflare': patch
---

Improves prebundling of internal Astro modules
1 change: 1 addition & 0 deletions packages/astro/src/manifest/serialized.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { VIRTUAL_PAGES_MODULE_ID } from '../vite-plugin-pages/index.js';
import { ASTRO_RENDERERS_MODULE_ID } from '../vite-plugin-renderers/index.js';
import { ASTRO_ROUTES_MODULE_ID } from '../vite-plugin-routes/index.js';

// This is used by Cloudflare optimizeDeps config
export const SERIALIZED_MANIFEST_ID = 'virtual:astro:manifest';
export const SERIALIZED_MANIFEST_RESOLVED_ID = '\0' + SERIALIZED_MANIFEST_ID;

Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/toolbar/vite-plugin-dev-toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { telemetry } from '../events/index.js';
import { eventAppToggled } from '../events/toolbar.js';
import type { AstroPluginOptions } from '../types/astro.js';

// This is used by Cloudflare optimizeDeps config
const VIRTUAL_MODULE_ID = 'astro:toolbar:internal';
const RESOLVED_VIRTUAL_MODULE_ID = '\0' + VIRTUAL_MODULE_ID;

Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/vite-plugin-adapter-config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { Plugin as VitePlugin } from 'vite';
import { isAstroServerEnvironment } from '../environments.js';
import type { AstroSettings } from '../types/astro.js';

// This is used by Cloudflare's optimizeDeps
const VIRTUAL_CLIENT_ID = 'virtual:astro:adapter-config/client';
const RESOLVED_VIRTUAL_CLIENT_ID = '\0' + VIRTUAL_CLIENT_ID;

Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/vite-plugin-css/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const MODULE_DEV_CSS = 'virtual:astro:dev-css';
const RESOLVED_MODULE_DEV_CSS = '\0' + MODULE_DEV_CSS;
const MODULE_DEV_CSS_PREFIX = 'virtual:astro:dev-css:';
const RESOLVED_MODULE_DEV_CSS_PREFIX = '\0' + MODULE_DEV_CSS_PREFIX;
// This is used by Cloudflare optimizeDeps config
const MODULE_DEV_CSS_ALL = 'virtual:astro:dev-css-all';
const RESOLVED_MODULE_DEV_CSS_ALL = '\0' + MODULE_DEV_CSS_ALL;
const ASTRO_CSS_EXTENSION_POST_PATTERN = '@_@';
Expand Down
14 changes: 12 additions & 2 deletions packages/integrations/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,24 @@ export default function createIntegration(args?: Options): AstroIntegration {
'astro > es-module-lexer',
'astro > unstorage',
'astro > neotraverse/modern',
'astro/app',
'astro/compiler-runtime',
],
exclude: [
'unstorage/drivers/cloudflare-kv-binding',
'astro:toolbar:internal',
'virtual:astro:middleware',
'astro:*',
'virtual:astro:*',
'virtual:astro-cloudflare:*',
],
},
};
} else if (environmentName === 'client') {
return {
optimizeDeps: {
include: ['astro/runtime/client/dev-toolbar/entrypoint.js'],
exclude: ['astro:*'],
},
};
}
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default defineConfig({
SECRET: envField.string({ context: 'server', access: 'secret' }),
}
},
prefetch: true,
experimental: {
fonts: [{
provider: fontProviders.google(),
Expand Down