mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
Silently ignore adapters that don't export start()
(#9911)
This commit is contained in:
parent
520be8b113
commit
aaedb848b1
2 changed files with 13 additions and 1 deletions
5
.changeset/tiny-moose-melt.md
Normal file
5
.changeset/tiny-moose-melt.md
Normal file
|
@ -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
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue