Skip to content

Commit

Permalink
fix(#5723): build prerendered pages with Netlify edge functions (#5885)
Browse files Browse the repository at this point in the history
* fix(#5723): build prerendered pages with Netlify edge functions

* chore: add changeset

Co-authored-by: Nate Moore <nate@astro.build>
  • Loading branch information
natemoo-re and natemoo-re authored Jan 18, 2023
1 parent dc2496f commit 8f1ae06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
5 changes: 5 additions & 0 deletions .changeset/spicy-parrots-beam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@astrojs/netlify': patch
---

Fix issue with prerendered pages when using `edge-functions` adapter
15 changes: 0 additions & 15 deletions packages/integrations/netlify/src/integration-edge-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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 }) => {
Expand Down

0 comments on commit 8f1ae06

Please sign in to comment.