Rescript watch is not building incrementally

I’m using rescript watch, but it keeps building every module rather than incrementally building only the changed files.

I noticed that if I have a %todo, I always see the warning. Perhaps this is unique to this type of warning, but I couldn’t find it in the docs.

Are todo warning always shown? If so, how can I toggle them on and off? I would like to silence them when building my test suite.

I tried, npx rescript build --warn-error -- "-110" but I get an error saying ‘-110’ is an unexpected argument.

Thanks for the help!

There is nothing fancy about my rescript.json:

{
  "name": "trt",
  "sources": [
    {
      "dir": "src",
      "subdirs": true
    },
    {
      "dir": "test/src",
      "subdirs": true,
      "type": "dev"
    }
  ],
  "package-specs": [
    {
      "module": "esmodule",
      "in-source": true
    }
  ],
  "suffix": ".res.mjs",
  "jsx": {
    "version": 4
  },
  "dependencies": [
     "@rescript/react"
  ],
  "compiler-flags": []
}

Welcome!

What you’re seeing is warning replay, not necessarily a full rebuild. Rewatch remembers warnings from unchanged modules and prints them again after each incremental build, otherwise they would disappear from the editor tooling.

I think your command would be written as:

npx rescript build --warn-error="-110"

But it does not do anything. It would only change something if you promoted warning 110 to error in rescript.json before. Then it would downgrade the error to a warning again, which it is by default.

To disable the warning, configure it in rescript.json:

{
  "warnings": {
    "number": "-110"
  }
}

To suppress it only in a particular module, add this at the top of the file:

@@warning("-110")

For reference also see warning-numbers.

1 Like