'How do you avoid full compilation with gyp?

I'm getting started with the `node-addon-api' and while my code does compile and run, I do get the following warning:

Generating code
  Previous IPDB not found, fall back to full compilation.
  All 303 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
  Finished generating code

Indeed, everything gets recompiled when I run the command (node-gyp rebuild -j max) and it is kind of slow, so avoiding a recompilation of all the files would be welcome, especially when the project becomes bigger.

All I could find was this page, but adding that flag didn't do anything (either under cflags, cflags_cc or msvs_settings). Here is my binding.gyp:

{
    "targets": [{
        "target_name": "template",
        "cflags!": [ "-fno-exceptions" ],
        "cflags_cc!": [ "-fno-exceptions" ],
        "sources": [
            "src/cpp/wrapper.cpp",
            "src/cpp/functionexample.cpp"
        ],
        'include_dirs': [
            "<!@(node -p \"require('node-addon-api').include\")"
        ],
        'libraries': [],
        'dependencies': [
            "<!(node -p \"require('node-addon-api').gyp\")"
        ],
        'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
        'msvs_settings': {
            'VCCLCompilerTool': { "ExceptionHandling": 1, 'AdditionalOptions': [ '-std:c++20' ] }
        }
    }]
}

Thank you in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source