0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00

Handle custom injected entry files during build (#5499)

This commit is contained in:
Bjorn Lu 2023-01-23 23:00:05 +08:00 committed by GitHub
parent 0d0974722f
commit 4987d6f44c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View file

@ -0,0 +1,5 @@
---
'astro': patch
---
Handle custom injected entry files during build

View file

@ -15,6 +15,7 @@ import { appendForwardSlash, prependForwardSlash } from '../../core/path.js';
import { isModeServerWithNoAdapter } from '../../core/util.js'; import { isModeServerWithNoAdapter } from '../../core/util.js';
import { runHookBuildSetup } from '../../integrations/index.js'; import { runHookBuildSetup } from '../../integrations/index.js';
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import { resolvedPagesVirtualModuleId } from '../app/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js';
import { info } from '../logger/core.js'; import { info } from '../logger/core.js';
import { getOutDirWithinCwd } from './common.js'; import { getOutDirWithinCwd } from './common.js';
@ -138,7 +139,13 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
chunkFileNames: `chunks/[name].[hash].mjs`, chunkFileNames: `chunks/[name].[hash].mjs`,
assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`, assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
...viteConfig.build?.rollupOptions?.output, ...viteConfig.build?.rollupOptions?.output,
entryFileNames: opts.buildConfig.serverEntry, entryFileNames(chunkInfo) {
if (chunkInfo.facadeModuleId === resolvedPagesVirtualModuleId) {
return opts.buildConfig.serverEntry;
} else {
return '[name].mjs';
}
},
}, },
}, },
ssr: true, ssr: true,