Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Rebuild source dependencies when package output settings change

未关闭
#8,539 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
48/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
ocaml

调研方向

首先跟踪初始化期间针对根 source-map 参数的现有依赖项失效处理,并检查 compiler-info.json 以及生成的 .cmj 构件。然后检查两个共享源依赖项的项目的集成测试设置。当更改包输出设置会使 Rewatch 重新构建该依赖项,并且两种模块顺序场景都能成功编译时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

Problem

Rewatch can reuse stale dependency build artifacts when projects with different package-specs build the same source dependency.

We encountered this while working on moving Belt into the separate @rescript/belt package in the ReScript compiler repository:

  1. The regular analysis tests build @rescript/belt through a CommonJS test project.
  2. The reanalyze tests subsequently use the same package through an ES module test project.
  3. Both projects reference the same source dependency and therefore share its build artifacts.
  4. Rewatch considers the existing Belt artifacts current and does not rebuild them for the second project.
  5. The reanalyze tests fail with a misleading Missing dependency Belt_* error.

This is not a particularly common project setup, but the compiler repository exposes the underlying invalidation problem because multiple test projects with different output formats build the same source dependency in sequence.

Dependencies are compiled using the consuming root project's package output settings. However, these settings are not recorded in lib/bs/compiler-info.json. Belt's .cmj files therefore still contain only the CommonJS package-output metadata when the ES module project is built.

The dependency files and compiler search path are present; it is the package-output metadata inside the .cmj files that is stale.

Proposed solution

Include the effective root package output settings in each package's compiler-info.json.

The stored value should contain a normalized representation of every effective package spec, including:

  • Module format
  • in-source
  • Resolved suffix, including the root-level suffix fallback

During initialization, compare the current package output settings with those stored in compiler-info.json. If they differ, clean and rebuild the affected dependency.

This follows the existing mechanism that invalidates dependency builds when root source-map arguments change.

Testing

Add an integration test with two projects sharing a source dependency:

  1. Build the dependency through a CommonJS project.
  2. Build it through an ES module project without explicitly cleaning the dependency.
  3. Verify that Rewatch rebuilds the dependency and that the second project compiles successfully.

Ideally, test the reverse order as well.

主要语言
OCaml
星标
7.5k
派生
485
平均合并
1 天 2 小时
30 天内合并 PR
55

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rescript-lang/rescript 的其他 Issue

查看 rescript-lang/rescript 的全部 Issue

相似的 Issue

更多 Build System Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。