aboutsummaryrefslogtreecommitdiff
path: root/packages/integrations/netlify/src
diff options
context:
space:
mode:
authorGravatar Theo Ephraim <theozero@gmail.com> 2024-07-08 20:27:38 +0200
committerGravatar GitHub <noreply@github.com> 2024-07-08 20:27:38 +0200
commit85b56690d8a8fa5e3a376c0003ada8f9ada32eb9 (patch)
tree516a35d4a79974cf355e51bab20eaaf7c974d381 /packages/integrations/netlify/src
parent2f750cbe9d9837e087ddb8995399d36c19ac7b62 (diff)
downloadastro-85b56690d8a8fa5e3a376c0003ada8f9ada32eb9.tar.gz
astro-85b56690d8a8fa5e3a376c0003ada8f9ada32eb9.tar.zst
astro-85b56690d8a8fa5e3a376c0003ada8f9ada32eb9.zip
chore(netlify): support `node:` prefixed imports (#286)
Co-authored-by: Matt Kane <m@mk.gg> Co-authored-by: Alexander Niebuhr <alexander@nbhr.io>
Diffstat (limited to 'packages/integrations/netlify/src')
-rw-r--r--packages/integrations/netlify/src/index.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/integrations/netlify/src/index.ts b/packages/integrations/netlify/src/index.ts
index 6dccc4e51..258d5c19e 100644
--- a/packages/integrations/netlify/src/index.ts
+++ b/packages/integrations/netlify/src/index.ts
@@ -297,6 +297,18 @@ export default function netlifyIntegration(
// taking over bundling, because Netlify bundling trips over NPM modules
await build({
entryPoints: [fileURLToPath(new URL('./entry.mjs', middlewareOutputDir()))],
+ // allow `node:` prefixed imports, which are valid in netlify's deno edge runtime
+ plugins: [
+ {
+ name: 'allowNodePrefixedImports',
+ setup(build) {
+ build.onResolve({ filter: /^node:.*$/ }, (args) => ({
+ path: args.path,
+ external: true,
+ }));
+ },
+ },
+ ],
target: 'es2022',
platform: 'neutral',
mainFields: ['module', 'main'],