Skip to content

Commit

Permalink
Merge branch 'main' into fix/8714
Browse files Browse the repository at this point in the history
  • Loading branch information
natemoo-re authored Jan 31, 2024
2 parents 4d4eaa7 + aaedb84 commit 5fc371e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/tiny-moose-melt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"astro": patch
---

Fixes an issue where some adapters that do not include a `start()` export would error rather than silently proceed
9 changes: 8 additions & 1 deletion packages/astro/src/core/build/plugins/plugin-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,14 @@ function generateSSRCode(adapter: AstroAdapter, middlewareId: string) {
return `export const ${name} = _exports['${name}'];`;
}
}) ?? []),
`serverEntrypointModule.start?.(_manifest, _args);`,
// NOTE: This is intentionally obfuscated!
// Do NOT simplify this to something like `serverEntrypointModule.start?.(_manifest, _args)`
// They are NOT equivalent! Some bundlers will throw if `start` is not exported, but we
// only want to silently ignore it... hence the dynamic, obfuscated weirdness.
`const _start = 'start';
if (_start in serverEntrypointModule) {
serverEntrypointModule[_start](_manifest, _args);
}`,
];

return {
Expand Down

0 comments on commit 5fc371e

Please sign in to comment.