fix(types): use namespace imports for Node.js built-in modules#12232
Merged
chenjiahan merged 2 commits intomainfrom Nov 18, 2025
Merged
fix(types): use namespace imports for Node.js built-in modules#12232chenjiahan merged 2 commits intomainfrom
chenjiahan merged 2 commits intomainfrom
Conversation
…rove TypeScript compatibility
✅ Deploy Preview for rspack ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes TypeScript compatibility issues when esModuleInterop: false is configured by changing Node.js built-in module imports from default imports to namespace imports and adding the node: prefix.
- Changed from default import syntax (
import type X from "Y") to namespace import syntax (import type * as X from "node:Y") for Node.js built-in modules - Added
node:prefix to all affected imports for consistency with modern Node.js best practices - Ensures type compatibility across different TypeScript configurations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
chenjiahan
approved these changes
Nov 18, 2025
Contributor
📦 Binary Size-limit
🙈 Size remains the same at 47.48MB |
CodSpeed Performance ReportMerging #12232 will not alter performanceComparing Summary
Footnotes |
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.
Summary
When users have
esModuleInterop: falsein their TypeScript configuration, importing Node.js built-in modules using default import syntax causes type errors:This happens because Node.js built-in modules use CommonJS format and don't have default exports.
Solution
Changed from default imports to namespace imports for Node.js built-in modules:
Related links
Checklist