Skip to content

Commit 92e07f0

Browse files
bartlomiejuclaude
andauthored
fix: resolve server entry filename from bundle chunks (#3719)
Closes #3655 --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 420a8cf commit 92e07f0

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

packages/plugin-vite/src/plugins/server_entry.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,16 @@ if (import.meta.hot) import.meta.hot.accept();`;
103103
},
104104
},
105105
async writeBundle(_options, bundle) {
106+
// Find server entry filename directly from bundle chunks.
107+
// This is more reliable than the manifest when rollupOptions
108+
// override output.entryFileNames.
109+
for (const chunk of Object.values(bundle)) {
110+
if (chunk.type === "chunk" && chunk.isEntry) {
111+
serverEntryFilename = chunk.fileName;
112+
break;
113+
}
114+
}
115+
106116
const manifest = bundle[".vite/manifest.json"];
107117

108118
const staticFiles: PendingStaticFile[] = [];
@@ -113,10 +123,6 @@ if (import.meta.hot) import.meta.hot.accept();`;
113123
const json = JSON.parse(manifest.source) as Manifest;
114124

115125
for (const item of Object.values(json)) {
116-
if (item.isEntry) {
117-
serverEntryFilename = item.file;
118-
}
119-
120126
if (item.assets) {
121127
for (let i = 0; i < item.assets.length; i++) {
122128
const id = item.assets[i];

0 commit comments

Comments
 (0)