0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-16 21:46:22 -05:00

Improve serverEntrypoint codegen (#12566)

* Remove fileurl handling

* fix
This commit is contained in:
Bjorn Lu 2024-12-04 18:33:01 +08:00 committed by GitHub
parent 62939add0b
commit 29bcdf5296
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View file

@ -30,7 +30,7 @@ export function vitePluginRenderers(opts: StaticBuildOptions): VitePlugin {
for (const renderer of opts.settings.renderers) { for (const renderer of opts.settings.renderers) {
const variable = `_renderer${i}`; const variable = `_renderer${i}`;
imports.push(`import ${variable} from '${renderer.serverEntrypoint}';`); imports.push(`import ${variable} from ${JSON.stringify(renderer.serverEntrypoint)};`);
rendererItems += `Object.assign(${JSON.stringify(renderer)}, { ssr: ${variable} }),`; rendererItems += `Object.assign(${JSON.stringify(renderer)}, { ssr: ${variable} }),`;
i++; i++;
} }

View file

@ -30,7 +30,7 @@ function vitePluginAdapter(adapter: AstroAdapter): VitePlugin {
}, },
async load(id) { async load(id) {
if (id === RESOLVED_ADAPTER_VIRTUAL_MODULE_ID) { if (id === RESOLVED_ADAPTER_VIRTUAL_MODULE_ID) {
return `export * from '${adapter.serverEntrypoint}';`; return `export * from ${JSON.stringify(adapter.serverEntrypoint)};`;
} }
}, },
}; };