Skip to content

feat(core): add output.bundleDependencies config option#1072

Merged
9aoy merged 6 commits intomainfrom
bundleDependencies
Mar 24, 2026
Merged

feat(core): add output.bundleDependencies config option#1072
9aoy merged 6 commits intomainfrom
bundleDependencies

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Mar 19, 2026

Summary

Background

Rstest ties the dependency bundling strategy to testEnvironment — browser-like environments (jsdom, happy-dom) bundle all node_modules, while Node externalizes them. Users have no straightforward way to override this without manually configuring output.externals per-package or reaching into tools.rspack. See #1064.

Implementation

  • Added output.bundleDependencies config option (boolean, 'true' for browser-like test environments, 'false' for node test environment) to ProjectConfig type definition.
  • Updated pluginExternal to read bundleDependencies and decide externalization independently of testEnvironment.name.
  • Added E2E tests that verify build output: check that strip-ansi source code is inlined (bundled) or absent (externalized).
  • Added documentation for both EN and ZH, including browser mode caveat and relationship with output.externals.

User Impact

Users can now set output.bundleDependencies: false in jsdom to externalize all dependencies, or true in Node to bundle everything, decoupling the bundling strategy from testEnvironment.

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Allow users to control whether third-party dependencies from node_modules
are bundled or externalized, independently of testEnvironment.

- 'auto' (default): bundle in browser-like envs, externalize in node
- true: always bundle all dependencies
- false: always externalize all dependencies
@9aoy 9aoy requested a review from fi3ework March 19, 2026 07:39
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 19, 2026

Deploying rstest with  Cloudflare Pages  Cloudflare Pages

Latest commit: 52ce7ef
Status: ✅  Deploy successful!
Preview URL: https://084f92f5.rstest.pages.dev
Branch Preview URL: https://bundledependencies.rstest.pages.dev

View logs

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

Rsdoctor Bundle Diff Analysis

Found 12 projects in monorepo, 2 projects with changes.

📊 Quick Summary
Project Total Size Change
adapter-rsbuild 2.1 KB 0
adapter-rslib 23.1 KB 0
adapter-rspack 5.9 KB 0
browser 2.0 MB +144.0 B (0.0%)
browser-react 3.7 KB 0
browser-ui 804.2 KB 0
coverage-istanbul 9.1 KB 0
core/rsdoctor-browser 1.2 MB 0
core/rsdoctor-loaders 869.0 B 0
core/rsdoctor-main 1.8 MB +152.0 B (0.0%)
vscode/rsdoctor-extension 59.5 MB 0
vscode/rsdoctor-worker 14.4 KB 0
📋 Detailed Reports (Click to expand)

📁 browser

Path: packages/browser/dist/rsdoctor-data.json

📌 Baseline Commit: 83800a5fb2 | PR: #1094

Metric Current Baseline Change
📊 Total Size 2.0 MB 2.0 MB +144.0 B (0.0%)
📄 JavaScript 2.0 MB 2.0 MB +144.0 B (0.0%)
🎨 CSS 11.8 KB 11.8 KB 0
🌐 HTML 765.0 B 765.0 B 0
📁 Other Assets 96.0 B 96.0 B 0

📦 Download Diff Report: browser Bundle Diff

📁 core/rsdoctor-main

Path: packages/core/dist/rsdoctor-main/rsdoctor-data.json

📌 Baseline Commit: 83800a5fb2 | PR: #1094

Metric Current Baseline Change
📊 Total Size 1.8 MB 1.8 MB +152.0 B (0.0%)
📄 JavaScript 1.7 MB 1.7 MB +152.0 B (0.0%)
🎨 CSS 0 B 0 B 0
🌐 HTML 0 B 0 B 0
📁 Other Assets 89.7 KB 89.7 KB 0

📦 Download Diff Report: core/rsdoctor-main Bundle Diff

Generated by Rsdoctor GitHub Action

@9aoy 9aoy merged commit e7ec36c into main Mar 24, 2026
18 checks passed
@9aoy 9aoy deleted the bundleDependencies branch March 24, 2026 11:37
@9aoy 9aoy mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: jsdom breaks module mock

2 participants