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:
parent
0d0974722f
commit
4987d6f44c
2 changed files with 13 additions and 1 deletions
5
.changeset/kind-seahorses-reply.md
Normal file
5
.changeset/kind-seahorses-reply.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
'astro': patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Handle custom injected entry files during build
|
|
@ -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,
|
||||||
|
|
Loading…
Reference in a new issue