feat(compiler): add bundleDependencies option to the rspack builder #3683
All Vouch review confidence checks passed
Residual risk 0.16 = Change Risk (0.40) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.40 · 294 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.340
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3683"
general
weight: 0.35
kamilmysliwiec
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
rspack builder keeps all of
node_modulesexternal, so prod image needs full dependency tree next todist. Bundling it today means hand written config: nowebpack-node-externals, builtins asnode-commonjsfor ESM,IgnorePluginfor optional peers, native addons kept external with ownpackage.json. And even then ESM deps that load CJS peers withcreateRequire(import.meta.url)keep build machine path in the bundle, so it runs only where it was builtIssue Number: N/A
What is the new behavior?
New opt-in
compilerOptions.bundleDependenciesfor rspack builder, ornest build --bundle-dependencies/--no-bundle-dependencies(nest starttoo):false(default) - same as now, only the app is compiledtrue- everything is bundled except Node builtins, packages with native addons andswagger-ui-dist(served from disk). Those are pinned in emitteddist/package.json,npm install --omit=devthere installs only them{ exclude: ['typeorm'] }- same, but listed packages stay external too, for deps that don't survive bundlingFlag overrides config, but keeps configured
exclude. With other builders it warns liketypeCheckdoes with non swc. In bundle modecreateRequirecalls are parsed, known optional packages are ignored only when not installed, and build prints what was ignored and what stays external. Unit specs cover all modesDoes this PR introduce a breaking change?
Other information
terminus needs nestjs/terminus#2790 to run bundled. Docs: nestjs/docs.nestjs.com#3746 (draft, to merge with release)
Numbers and details in comments below