In my node module I use larger library in source code which takes a while to compile. I believe this has to do with the --no-parallel
setting used by default by node-gyp. Now I wonder if it is possible to make node-gyp compile cpp files in parallel to speed up this process. I couldn't find anything that would help on the GYP format reference page. Is there a setting for my project gyp file or a hack for node-gyp?
Simply add this to your package.json file.
"scripts": {
"install": "node-gyp rebuild -j max"
},
This is cross-platform (contrary to using env JOBS=
which does not work in cmd
as an example)
max
ensures using all the available threads. If you don't want to use all your CPU capacity specify a specific number of threads instead of max
.