feat(pack): harden server bundling and simplify configuration#2808
feat(pack): harden server bundling and simplify configuration#2808
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the server function implementation into a more general "server reference" system. It updates the configuration schema to support explicit server entry points and custom modules for client/server reference handling. Key changes include deterministic sorting of server modules, the addition of server-side registration logic, and the ability to bundle a standalone server entry. Feedback focuses on ensuring the server bundle is generated when an entry point is provided even without server functions, resolving inconsistencies in default export handling, and respecting configured output filenames.
| // Build server functions as Node.js if configured | ||
| let server_config = this.project.config().server().await?; | ||
| let output_assets = if server_config.functions.is_some() { | ||
| let output_assets = if server_config.client_reference.is_some() { |
There was a problem hiding this comment.
The condition for building server assets is too restrictive. If a user provides a server entry but no server functions (and thus no client_reference), the server bundle will not be generated at all. The condition should include server_config.entry.is_some() to ensure the server entry point is processed even when no server functions are present.
| let output_assets = if server_config.client_reference.is_some() { | |
| let output_assets = if server_config.client_reference.is_some() || server_config.entry.is_some() { |
…s and integrate entry format changes
- Ensure server bundle builds when entry is provided even without server functions - Proceed with server entry resolution even if unique_server_modules is empty - Allow default exports during server reference registration - Respect server.output.filename configuration for server chunk name
|
@gemini-code-assist All feedback points addressed:
|
|
Thank you for the update, @xusd320. The changes to the server bundling logic and the configuration simplification look solid and well-aligned with the requirements for supporting RSC-like server references. I appreciate the attention to detail regarding the |
…ions - Extract flat clientReference and serverReference into a server.function namespace. - Use explicit identifiers: clientProxy and serverRegister to better annotate the RPC networking role. - Adds TODO mapping block for server.component RSC schema
566669e to
628ca93
Compare
…Reference - Align example with expected server reference ast proxy module requirements
…modules - Document expected TS signatures for createServerReference inside clientProxy - Document expected TS signatures for registerServerReference inside serverRegister
- Generalize proxy module documentation to reflect the actual utoo generated AST logic
- Add missing `entry` field to server config typings - Update `functions.callServerModule` to `function` with `clientProxy` and `serverRegister` typings
Resolves issue where Turbopack module scope bundler renamed target server functions, mismatching the injected registerServerReference call, by cloning the original Ident instead of generating an uncontextualized identifier.
Verifies that multiple modules exporting the same server function name natively avoid collisions by receiving unique hashes and preserving localized scopes without `registerServerReference` conflicting.
…lize runtime factory exports
📊 Performance Benchmark Report (with-antd)Utoopack Performance ReportReport ID: Executive Summary
Build Phase TimelineShows when each build phase is active and how much CPU it consumes.
Workload Distribution by Diagnostic Tier
Top 20 Tasks by Self-TimeSelf-time is the exclusive duration: time spent in the task itself, not in sub-tasks.
Critical Path AnalysisThe longest sequential dependency chains that determine wall-clock time.
Batching CandidatesHigh-volume tasks dominated by a single parent. If the parent can batch them,
Duration Distribution
Action Items
Report generated by Utoopack Performance Analysis Agent |
This PR hardens the RSC-like server bundling process and simplifies the configuration of server functions.
Key changes:
index.jschunk.clientReferenceandserverReferencedirectly into theserverconfiguration block../input/transport.ts) for client and server references, which are handled via internal bundler aliases.examples/with-server-referencesworkspace.pack-api/src/app.rs.