Skip to content

Commit

Permalink
chore: externalize cloudflare:sockets imports (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderniebuhr authored Oct 27, 2024
1 parent 0c16fee commit d63bed8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/good-rivers-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/cloudflare': patch
---

Fixes an issue where `cloudflare:` scoped imports made the build fail. We externalize all imports with the `cloudflare:` scope by default now.
10 changes: 10 additions & 0 deletions packages/cloudflare/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,16 @@ export default function createIntegration(args?: Options): AstroIntegration {
// https://developers.cloudflare.com/pages/functions/module-support/
// Allows imports of '.wasm', '.bin', and '.txt' file types
cloudflareModulePlugin,
{
name: 'vite:cf-imports',
enforce: 'pre',
resolveId(source) {
if (source.startsWith('cloudflare:')) {
return { id: source, external: true };
}
return null;
},
},
],
},
integrations: [astroWhen()],
Expand Down

0 comments on commit d63bed8

Please sign in to comment.