From 8f1ae06e58f37c7d9e3b9076268b6e91546bdc07 Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 18 Jan 2023 12:54:49 -0600 Subject: [PATCH] fix(#5723): build prerendered pages with Netlify edge functions (#5885) * fix(#5723): build prerendered pages with Netlify edge functions * chore: add changeset Co-authored-by: Nate Moore --- .changeset/spicy-parrots-beam.md | 5 +++++ .../netlify/src/integration-edge-functions.ts | 15 --------------- 2 files changed, 5 insertions(+), 15 deletions(-) create mode 100644 .changeset/spicy-parrots-beam.md diff --git a/.changeset/spicy-parrots-beam.md b/.changeset/spicy-parrots-beam.md new file mode 100644 index 0000000000..9cd38b278b --- /dev/null +++ b/.changeset/spicy-parrots-beam.md @@ -0,0 +1,5 @@ +--- +'@astrojs/netlify': patch +--- + +Fix issue with prerendered pages when using `edge-functions` adapter diff --git a/packages/integrations/netlify/src/integration-edge-functions.ts b/packages/integrations/netlify/src/integration-edge-functions.ts index a05f8f3a0f..2ba6198659 100644 --- a/packages/integrations/netlify/src/integration-edge-functions.ts +++ b/packages/integrations/netlify/src/integration-edge-functions.ts @@ -117,18 +117,6 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {}) name: '@astrojs/netlify/edge-functions', hooks: { 'astro:config:setup': ({ config, updateConfig }) => { - // Add a plugin that shims the global environment. - const injectPlugin: VitePlugin = { - name: '@astrojs/netlify/plugin-inject', - generateBundle(_options, bundle) { - if (_buildConfig.serverEntry in bundle) { - const chunk = bundle[_buildConfig.serverEntry]; - if (chunk && chunk.type === 'chunk') { - chunk.code = `globalThis.process = { argv: [], env: {}, };${chunk.code}`; - } - } - }, - }; const outDir = dist ?? new URL('./dist/', config.root); updateConfig({ outDir, @@ -137,9 +125,6 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {}) server: new URL('./.netlify/edge-functions/', config.root), serverEntry: 'entry.js', }, - vite: { - plugins: [injectPlugin], - }, }); }, 'astro:config:done': ({ config, setAdapter }) => {