-
-
Notifications
You must be signed in to change notification settings - Fork 82
fix: the require() ESM problem when node < 20.19 #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for rsdoctor ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this 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 ESM compatibility issues for Node.js versions below 18.19 by updating import statements and resolving loader paths more robustly.
- Replaced
fs-extra/esm
imports with standardfs-extra
imports - Updated file operations to use Node.js built-in
fs
methods instead of fs-extra in some cases - Added fallback logic for loader path resolution to handle both ESM and CJS environments
- Moved
@rsbuild/plugin-check-syntax
from devDependencies to dependencies to avoid prebundling issues
Reviewed Changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
packages/utils/src/build/file/index.ts | Changed fs-extra import from ESM-specific to standard import |
packages/sdk/src/sdk/sdk/index.ts | Replaced fs-extra method with Node.js built-in fs methods |
packages/sdk/src/sdk/sdk/core.ts | Changed from sync to async fs-extra method |
packages/core/src/inner-plugins/plugins/loader.ts | Added fallback logic to resolve proxy loader paths |
packages/core/src/build-utils/build/utils/loader.ts | Updated fs-extra import from ESM-specific to standard |
packages/core/rslib.config.ts | Added comment about ESM file handling |
packages/core/prebundle.config.mjs | Removed @rsbuild/plugin-check-syntax from prebundle dependencies |
packages/core/package.json | Moved @rsbuild/plugin-check-syntax to production dependencies |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
036d347
to
fce67ee
Compare
Summary
Related Links
#1339