Skip to content

fix(vite): use manifest entry filename for server entry import#3595

Merged
bartlomieju merged 4 commits into
freshframework:mainfrom
cuipeiyu:server-entry-filename
Mar 25, 2026
Merged

fix(vite): use manifest entry filename for server entry import#3595
bartlomieju merged 4 commits into
freshframework:mainfrom
cuipeiyu:server-entry-filename

Conversation

@cuipeiyu
Copy link
Copy Markdown
Contributor

@cuipeiyu cuipeiyu commented Nov 4, 2025

Summary

When rollupOptions.output.entryFileNames is customized in vite config (e.g. [hash].mjs), the generated server.js was hardcoding server-entry.mjs as the import path, causing the server to fail to start.

This fix reads the actual entry filename from the Vite manifest and uses it in the generated server.js import, falling back to server-entry.mjs when no custom naming is configured.

Changes

  • Read isEntry file path from the Vite manifest in writeBundle
  • Use the manifest filename (with fallback) when generating server.js
  • Add test verifying custom entryFileNames produces correct server.js import

Test plan

  • Existing build tests pass
  • New test: vite build - custom rollup entryFileNames in server.js verifies the generated server.js uses the hashed filename instead of hardcoded server-entry.mjs

Copy link
Copy Markdown
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, let's add a test for that

Copy link
Copy Markdown
Contributor

@marvinhagemeister marvinhagemeister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! Let's add a test case for this

@bartlomieju bartlomieju changed the title feat(vite): Use the file names listed in the 'manifest.json' file as the 'server-entry' entry file. fix(vite): use manifest entry filename for server entry import Mar 25, 2026
bartlomieju and others added 3 commits March 25, 2026 19:38
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Verify that when rollupOptions.output.entryFileNames is customized,
the generated server.js imports from the actual manifest filename
instead of the hardcoded "server-entry.mjs".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@bartlomieju bartlomieju enabled auto-merge (squash) March 25, 2026 18:42
@bartlomieju bartlomieju merged commit 421e339 into freshframework:main Mar 25, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants