Repository navigation
fix(vite): preserve SSR entry import order when registering manifests - #733
Merged
Merged
Conversation
Follow-up to #725, which appends an import of a virtual manifest module to the server entry: - Import `./<entry file>?oxc-angular-ssr-manifest` instead of `virtual:oxc-angular/ssr-manifest`. Server configs that keep every bare import external turned the bare `virtual:` import into a runtime import that Node cannot load. - The module id is now `<entry path>?oxc-angular-ssr-manifest`, so its imports of `@angular/ssr` and the bootstrap resolve from the entry's directory. With the `\0virtual:` id, Vite resolved `@angular/ssr` from the root, which can be another copy than the one the entry uses. - Resolve the import before Vite's resolver, which would mark the module free of side effects in a `"sideEffects": false` package and drop it. - Tests: build and run the server for an external-everything config, a `"sideEffects": false` package and an entry in `src/` with its own `@angular/ssr`; keep the Nitro test on the `ɵsetAngularAppManifest` guard by feeding it the inlined manifests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
@codex review |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #725 by @nagahara-naoki and keeps their commit. Their branch doesn't allow edits by maintainers, so the follow-up lands here.
Problem (from #725)
The SSR manifest plugin prepended
import … from '@angular/ssr'plus the manifest calls to the server entry. An entry that imports@angular/compilerfirst (JIT support for externalized libraries) then failed at startup withJIT compilation failed for injectable [class PlatformLocation], because@angular/ssrran before the compiler.Fix
Commit 1 (#725): append an import of a generated manifest module to the entry instead. ESM runs it after the entry's own imports and before the entry body constructs the engine.
Commit 2 (follow-up): change how that module is imported and resolved:
externalkeeps every bare import externalimport "virtual:…"and Node crashes (ERR_UNSUPPORTED_ESM_URL_SCHEME)@angular/ssrnext to the entry, another copy at the root, bundled"sideEffects": falseTests
"sideEffects": false, and an entry insrc/with its own@angular/ssrandmain.server.ts(decoys at the root).ssrbeforecompiler). The external andsrc/tests fail on fix(vite): preserve SSR entry import order when registering manifests #725 alone. The side-effects test fails withoutorder: 'pre'.ɵsetAngularAppManifestguard again.ssr-manifest.spec.ts) 9/9,tsc,oxfmt --check,oxlint --type-aware --type-check.Known limits (pre-existing, not changed here)
output.preserveModules(or chunking that splits the manifest module out) and an external@angular/compiler, Rolldown writes chunk imports before external imports, so the manifest can still run first. Rolldown reorders the user's own imports the same way.Closes #725
🤖 Generated with Claude Code