Skip to content

fix: stripping types error under node_modules#730

Merged
9aoy merged 2 commits intomainfrom
bundle-typescript-files
Dec 3, 2025
Merged

fix: stripping types error under node_modules#730
9aoy merged 2 commits intomainfrom
bundle-typescript-files

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Dec 3, 2025

Summary

fix stripping types error under node_modules.

In the Node.js test environment, Rstest will bundle and transpile the following files by default:

  • Any TypeScript and JSX files in any directory, with file extensions .ts, .tsx, .jsx, .mts, .cts.
  • JavaScript files outside the node_modules directory, with file extensions .js, .mjs, .cjs.

Related Links

fix: #461

Checklist

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

Copilot AI review requested due to automatic review settings December 3, 2025 05:07
@netlify
Copy link
Copy Markdown

netlify bot commented Dec 3, 2025

Deploy Preview for rstest-dev ready!

Name Link
🔨 Latest commit bf4b366
🔍 Latest deploy log https://app.netlify.com/projects/rstest-dev/deploys/692fc5a24044e10008f77c5a
😎 Deploy Preview https://deploy-preview-730--rstest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a stripping types error for TypeScript files located under node_modules by changing the default bundling behavior in the Node.js test environment. Previously, all files in node_modules were externalized, which caused issues when packages contained TypeScript source files. Now, TypeScript and JSX files are bundled regardless of their location, while JavaScript files in node_modules remain externalized.

Key changes:

  • Modified external dependency logic to bundle TypeScript/JSX files (.ts, .tsx, .jsx, .mts, .cts) from any directory including node_modules
  • Updated documentation in both English and Chinese to accurately reflect the new bundling behavior
  • Simplified test setup by removing the workaround configuration that was previously needed to bundle node_modules

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/core/src/core/plugins/external.ts Updated autoExternalNodeModules function to exclude TypeScript/JSX files from externalization using a regex pattern check
website/docs/en/config/build/output.mdx Updated English documentation to describe the new bundling behavior for TypeScript/JSX files and JavaScript files
website/docs/zh/config/build/output.mdx Updated Chinese documentation to match the English version with the new bundling behavior
e2e/externals/fixtures/rstest.bundle.config.ts Removed config file that was previously needed to force bundling of node_modules
e2e/externals/fixtures/bundle.test.ts Updated test description to be more specific about testing TypeScript package loading
e2e/externals/bundle.test.ts Simplified test by removing the config file reference and updated test descriptions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Dec 3, 2025

📝 Rstest Ecosystem CI: Open

suite result
rslib ✅ success
rsdoctor ✅ success
rsbuild ✅ success

@9aoy 9aoy merged commit 6abf780 into main Dec 3, 2025
23 checks passed
@9aoy 9aoy deleted the bundle-typescript-files branch December 3, 2025 06:27
@9aoy 9aoy mentioned this pull request Dec 4, 2025
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]: Stripping types is currently unsupported for files under node_modules

2 participants