rescript-compiler icon indicating copy to clipboard operation
rescript-compiler copied to clipboard

`rescript build -w` non-terminating rebuild

Open ninesunsabiu opened this issue 4 years ago • 5 comments

在使用 build 的 watch 模式时,如果 .res 文件中有 unused variable,compiler 会陷入无限循环的场景。

Reproduction Repo

https://github.com/ninesunsabiu/rescript-proj-tpl

Steps to reproduce

npm install
npm run start

如果没有直接触发的话,再一次保存 Demo.res 就可以触发。 有怀疑是 gentype 的问题,因为一加上就会报错。

Snapshot

snapshot 截图上面的操作就是在 watch 模式下,有 @genType 和 没有 @genTyp 的控制台输出区别

Environment

  • OS: macOS Catalina / Mojave
  • Editor: VS Code 1.60.1
  • Terminal: zsh
  • Node.js: v12.18.3
  • Npm: 7.23.0

Thank you for filing! Check list:

  • [x] Is it a bug? Usage questions should often be asked in the forum instead.
  • [ ] Concise, focused, friendly issue title & description.
  • [x] A minimal, reproducible example.
  • [x] OS and browser versions, if relevant.
  • [ ] Is it already fixed in master?

ninesunsabiu avatar Sep 22 '21 02:09 ninesunsabiu

This is due to that the build system noticed Demo.gen.ts changed (the generated file). It should be an easy fix.

CC @cristianoc , besides gen.ts, what other files are generated by gentype

bobzhang avatar Sep 22 '21 12:09 bobzhang

This is due to that the build system noticed Demo.gen.ts changed (the generated file). It should be an easy fix.

CC @cristianoc , besides gen.ts, what other files are generated by gentype

@bobzhang gentype can generate files with several extensions, not just gen.ts (e.g. .gen.tsx, .mygen.tsx,...). This can be configured in gentypeconfig.generatedFileExtension inside "bsconfig" file.

Not sure if this is what you asked though. Hopefully it is.

searleser97 avatar Sep 28 '21 00:09 searleser97

The default is .tsx and I know people use .ts but don't know of other extension. The feature to enable changing the extension is experimental.

cristianoc avatar Sep 28 '21 06:09 cristianoc

I made a PR that modifies the CLI script can fix this by checking gentypeconfig.generatedFileExtension.

Zeta611 avatar Jun 28 '22 09:06 Zeta611

According to the code, the issue has been fixed.

DZakh avatar Sep 22 '23 17:09 DZakh