Ability to add flag "--include=dev" to "npm install" for static websites

I recently ran into an issue where setting NODE_ENV=production in the environment would skip loading devDependencies, but in the context of building a static website this crashes the next steps (A Gatsby app)

I believe NODE_ENV=production performs extra optimization steps, and even some app code uses feature flag switches to enable different behavior in production (such as asset management)

Is possible to override the “npm instal” command with the flag specifically tailored for this ?

npm install --include=dev

Currently I’ve added an extra npm install --include=dev && in my Build Command which seems to work, but I believe this might skip node_module caching or other optimizations on render.com side.

Hi there,

It’s perfectly fine to override the build command for static sites, it won’t skip and caching done. If you are doing this you may want to set SKIP_INSTALL_DEPS: https://docs.render.com/static-sites#dependency-installation. This means that npm install isn’t run by us, just the build command you set.


Render Support, UTC+10 :australia:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.