napalm icon indicating copy to clipboard operation
napalm copied to clipboard

node_modules get rebuilt with the main derivation

Open zimbatm opened this issue 5 years ago • 2 comments

Whenever the source changes, the node_modules get rebuilt. For development this can add quite a lot to the iteration time.

What would you think of building the node_modules in a separate derivation and then symlinking it into the main derivation during build? We are doing something similar in yarn2nix.

zimbatm avatar Jan 03 '20 13:01 zimbatm

very good point! I haven't used napalm for local development (I npm build) but I understand this can be an issue.

nmattia avatar Jan 06 '20 11:01 nmattia

For local development, there could also be a mode where node_modules gets symlinked into the current folder when the shellHook get executed. That way the user has the exact same dependencies and can also fetch them from binary cache.

zimbatm avatar Jan 06 '20 20:01 zimbatm