Skip to content

Commit

Permalink
Handle custom injected entry files during build (#5499)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluwy committed Jan 23, 2023
1 parent 0d09747 commit 4987d6f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/kind-seahorses-reply.md
@@ -0,0 +1,5 @@
---
'astro': patch
---

Handle custom injected entry files during build
9 changes: 8 additions & 1 deletion packages/astro/src/core/build/static-build.ts
Expand Up @@ -15,6 +15,7 @@ import { appendForwardSlash, prependForwardSlash } from '../../core/path.js';
import { isModeServerWithNoAdapter } from '../../core/util.js';
import { runHookBuildSetup } from '../../integrations/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 { info } from '../logger/core.js';
import { getOutDirWithinCwd } from './common.js';
Expand Down Expand Up @@ -138,7 +139,13 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
chunkFileNames: `chunks/[name].[hash].mjs`,
assetFileNames: `${settings.config.build.assets}/[name].[hash][extname]`,
...viteConfig.build?.rollupOptions?.output,
entryFileNames: opts.buildConfig.serverEntry,
entryFileNames(chunkInfo) {
if (chunkInfo.facadeModuleId === resolvedPagesVirtualModuleId) {
return opts.buildConfig.serverEntry;
} else {
return '[name].mjs';
}
},
},
},
ssr: true,
Expand Down

0 comments on commit 4987d6f

Please sign in to comment.