Skip to content

chore(build): prebundle jiti#7163

Merged
chenjiahan merged 2 commits intomainfrom
prebundle_jiti_0209
Feb 9, 2026
Merged

chore(build): prebundle jiti#7163
chenjiahan merged 2 commits intomainfrom
prebundle_jiti_0209

Conversation

@chenjiahan
Copy link
Member

Summary

Prebundle jiti to minimize the number of dependencies for @rsbuild/core.

We still need jiti to support rsbuild.config.ts on Node 20, but jiti should be removed in Rsbuild 3.0.

Checklist

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

Copilot AI review requested due to automatic review settings February 9, 2026 02:44
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @chenjiahan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly refactors the dependency handling for jiti within the @rsbuild/core package. By prebundling jiti and moving it to devDependencies, the aim is to reduce the overall number of direct runtime dependencies, leading to a leaner core package. This change also sets the stage for jiti's eventual removal in Rsbuild 3.0, while maintaining necessary support for rsbuild.config.ts on Node 20 in the current version. The build process has been updated to manage this prebundled dependency effectively.

Highlights

  • Jiti Dependency Relocation: The jiti package has been moved from dependencies to devDependencies in packages/core/package.json, signifying its role shifting from a direct runtime dependency to a build-time or development-time tool.
  • Jiti Prebundling Implementation: A new prepare build step has been introduced in packages/core/rslib.config.ts to explicitly copy the jiti package from node_modules into a compiled directory, ensuring it's available in a prebundled form.
  • Module Resolution Update: The build configuration in packages/core/rslib.config.ts and packages/core/prebundle.config.ts has been updated to correctly resolve jiti imports to its new prebundled location (../compiled/jiti/lib/jiti.mjs).
  • Build Process Refinement: The client build configuration in rslib.config.ts has been refactored, with its functionality likely absorbed or streamlined by the new prepare step, and a dependency added to ensure prepare runs first.
  • Lockfile Updates: The pnpm-lock.yaml file has been updated to reflect the changes in jiti's dependency type and to include libc specifications for various native packages, improving build consistency across different environments.
Changelog
  • packages/core/package.json
    • Moved jiti dependency from dependencies to devDependencies.
  • packages/core/prebundle.config.ts
    • Updated jiti external path from 'jiti' to '../jiti'.
  • packages/core/rslib.config.ts
    • Added a new lib entry with id: 'prepare' to handle client module building and copying jiti from node_modules to compiled/jiti.
    • Modified the externals configuration to resolve jiti imports to ../compiled/jiti/lib/jiti.mjs.
    • Removed the separate client lib entry and added dependencies: ['prepare'] to the node lib entry's rspack tools configuration, indicating a refactoring of the build order and client-related tasks.
  • pnpm-lock.yaml
    • Updated jiti's entry to reflect its new devDependencies status.
    • Added libc specifications to numerous native package entries (e.g., @ast-grep/napi, @biomejs/cli, @nx/nx, @parcel/watcher, @rollup/rollup, @rspack/binding, @tailwindcss/oxide, lightningcss, sass-embedded) for more precise dependency resolution.
Activity
  • The pull request was created by chenjiahan.
  • The author provided a clear summary of the changes and their motivation, including the long-term plan for jiti.
  • A checklist for tests and documentation is included, indicating standard development practices.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request pre-bundles jiti to minimize dependencies for @rsbuild/core. The changes involve moving jiti to devDependencies, adding a build step to copy it to the compiled directory, and updating build configurations to use this pre-bundled version. The implementation is sound, but I have one suggestion to make the module resolution for jiti more robust.

Copy link
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 updates @rsbuild/core’s build/prebundle pipeline to ship jiti inside the package (under compiled/) instead of keeping it as a runtime dependency, while preserving rsbuild.config.ts loading support on Node 20.

Changes:

  • Move jiti from dependencies to devDependencies for @rsbuild/core, relying on a shipped compiled copy instead.
  • Add a build “prepare” step to copy node_modules/jiti into packages/core/compiled/jiti and ensure build ordering.
  • Update prebundle externals to resolve jiti via the compiled copy.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
pnpm-lock.yaml Reflects dependency move of jiti and updated lock metadata.
packages/core/rslib.config.ts Copies jiti into compiled/ during build and rewrites externals to load it from there.
packages/core/prebundle.config.ts Adjusts postcss-loader external mapping for jiti to point at the compiled copy.
packages/core/package.json Removes jiti from runtime deps and adds it to dev deps (packaging still includes compiled/).
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f01f266ac5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chenjiahan chenjiahan merged commit 9d260aa into main Feb 9, 2026
12 checks passed
@chenjiahan chenjiahan deleted the prebundle_jiti_0209 branch February 9, 2026 02:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant