Skip to content

Conversation

@fireairforce
Copy link
Contributor

@fireairforce fireairforce commented Jan 14, 2026

Summary

在 linux gun 场景里面使用 devServer 的时候监听 node_modules 里面的文件变更会有比较大的性能损失。

目前 webpack 默认不监听 node_modules 中的依赖文件变更。

ref: utooland/next.js#97

Test Plan

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @fireairforce, 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!

此拉取请求旨在通过在文件监听配置中默认忽略 node_modules 目录来解决在 Linux 开发环境中 devServer 监听文件变更时可能出现的性能问题。这一改动确保了文件系统监听器不会处理 node_modules 内部的频繁变动,从而显著提升开发体验和系统效率。

Highlights

  • WatchOptions 结构体新增 ignored 字段: 在 crates/pack-api/src/project.rs 中,WatchOptions 结构体新增了一个 ignored 字段,用于指定文件监听时需要忽略的路径,默认值为 node_modules
  • 文件系统创建逻辑更新: Project::disk_fs 方法现在会获取配置中忽略的路径,并在创建 DiskFileSystem 时传递这些路径,以确保文件监听器不会监控这些目录。
  • NAPI 和 Schema 层支持 ignored 选项: crates/pack-napi/src/pack_api/project.rscrates/pack-schema/src/lib.rs 中的相关结构体也新增了 ignored 字段,使得该配置可以通过 NAPI 接口和配置 Schema 进行设置和传递。
  • next.js 子模块更新: next.js 子模块已更新到最新提交,以集成 pack 模块的这些性能改进。
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

这个 PR 通过添加一个选项来在文件监听时忽略指定路径,从而提高了性能,默认忽略 node_modules。这与 Webpack 的行为类似,是一个很好的改进。代码在 API、N-API 和 schema 层的修改看起来是正确的。我有一个关于移除重复的默认值以提高代码可维护性的建议。

@fireairforce fireairforce merged commit 0aae6fb into next Jan 15, 2026
@fireairforce fireairforce deleted the fix-hmr-listen branch January 15, 2026 16:23
elrrrrrrr pushed a commit that referenced this pull request Jan 16, 2026
* fix(pack): add node_modules to watch ignore options

* chore: update review

* chore: update napi files
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.

2 participants