fix(ssr): throw on missing named exports in inlined modules - #23360
fix(ssr): throw on missing named exports in inlined modules#23360bun-unsafe wants to merge 5 commits into
Conversation
Vite-transformed SSR modules skipped analyzeImportedModDifference. A missing named import from a local ESM file succeeded, while Node throws SyntaxError. Run the same ESM check after the module finishes evaluating; skip it on incomplete circular graphs.
Vite-transformed SSR modules skipped analyzeImportedModDifference. A missing named import from a local ESM file succeeded, while Node throws SyntaxError. Run the same ESM check after the module finishes evaluating; skip it on incomplete circular graphs.
|
This PR has been automatically flagged as likely to be created by a bot, LLM, or agent, and will be automatically closed. These contributions harm the maintenance of the project. Please read our AI policy for more information. If you believe this is a mistake, please reply to this comment and we will review it. |
|
This is a bugfix, not a feature. Node throws SyntaxError for The patch runs the same ESM check after the module has finished evaluating, and skips it on incomplete circular graphs so existing cycle tests stay valid. Tests are in server-runtime.spec.ts with the new fixtures. Please review the diff. If the bot misfired, could a maintainer apply |
|
Is this fixing a specific issue, or one you encountered yourself? |
|
No existing GitHub issue. I hit this myself. I compared Node Happy to open an issue for tracking if you prefer. |
|
recheck |
ssrLoadModule and the module runner accept
import { missing }from a local ESM file. Node throws SyntaxError for the same graph.I compared Node
import()with Vite SSR on the same files. External packages already go throughanalyzeImportedModDifference. Inlined modules did not:processImportreturned early, and inlined fetch results have notype.This runs that ESM check after the imported module has finished evaluating, with type
module. Circular graphs can observe a partialexportsobject, so the check is skipped until evaluation finishes.Tests:
server-runtime.spec.tsfixturesesm-internal-non-existing.jsandesm-internal-existing.js.