`rescript build -w` non-terminating rebuild
在使用 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
截图上面的操作就是在 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?
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
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.
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.
I made a PR that modifies the CLI script can fix this by checking gentypeconfig.generatedFileExtension.
According to the code, the issue has been fixed.