fix(packages/ui): bundle rspress plugins to fix Node.js 24 ESM resolution#54
fix(packages/ui): bundle rspress plugins to fix Node.js 24 ESM resolution#54zrosenbauer merged 2 commits intomainfrom
Conversation
…tion
Move rspress-plugin-{devkit,file-tree,katex,supersub} from dependencies to
devDependencies so Rslib bundles them into the UI output instead of
externalizing them. This eliminates ERR_MODULE_NOT_FOUND errors caused by
extensionless relative imports in the plugins' dist files, which Node.js 24
rejects under strict ESM resolution.
Remove the now-unnecessary pnpm patches that manually added .js extensions.
Co-Authored-By: Claude <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 88b86bc The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA changeset marks a patch release for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ui/package.json (1)
80-83: Consider adding a CI guard to prevent regressions.A lightweight post-build check (e.g., fail if
dist/index.mjsstill containsfrom "rspress-plugin-") would catch future externalization drift early.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ui/package.json` around lines 80 - 83, Add a post-build CI guard that scans the built bundle (dist/index.mjs) for any remaining external import patterns like from "rspress-plugin-" and fails the job if found; implement this as a lightweight script (e.g., npm script or CI step) that greps/dist file for the string "from \"rspress-plugin-\"" and exits non-zero when matched, wire it into existing build/test pipeline so the build step that produces dist/index.mjs is followed by this check to prevent externalization drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/ui/package.json`:
- Around line 80-83: Add a post-build CI guard that scans the built bundle
(dist/index.mjs) for any remaining external import patterns like from
"rspress-plugin-" and fails the job if found; implement this as a lightweight
script (e.g., npm script or CI step) that greps/dist file for the string "from
\"rspress-plugin-\"" and exits non-zero when matched, wire it into existing
build/test pipeline so the build step that produces dist/index.mjs is followed
by this check to prevent externalization drift.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b3274dee-cd60-495e-9342-18a6a939cae4
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
.changeset/bundle-rspress-plugins.mdpackage.jsonpackages/ui/package.jsonpatches/rspress-plugin-devkit@1.0.0.patchpatches/rspress-plugin-file-tree@1.0.4.patchpatches/rspress-plugin-katex@1.0.0.patchpatches/rspress-plugin-supersub@1.0.0.patch
💤 Files with no reviewable changes (5)
- package.json
- patches/rspress-plugin-file-tree@1.0.4.patch
- patches/rspress-plugin-devkit@1.0.0.patch
- patches/rspress-plugin-supersub@1.0.0.patch
- patches/rspress-plugin-katex@1.0.0.patch
Add shims.esm config to inject __dirname, __filename, and require polyfills into the ESM output. The bundled rspress plugins use require.resolve() and __dirname which don't exist natively in ESM. Co-Authored-By: Claude <noreply@anthropic.com>
Summary
devkit,file-tree,katex,supersub) ship extensionless relative imports in their ESM dist files, causingERR_MODULE_NOT_FOUNDon Node.js 24 which enforces strict ESM resolutiondependenciestodevDependenciesin@zpress/uiso Rslib bundles them inline instead of externalizing them — the bundler resolves imports internally, bypassing the extension issue entirely.jsextensions (no longer needed)Test plan
pnpm buildpasses — all 9 packages build successfullydist/index.mjscontains noimport ... from "rspress-plugin-*"statements (plugins are inlined)zpress devruns withoutERR_MODULE_NOT_FOUNDon Node.js 24Summary by CodeRabbit
Bug Fixes
Chores