3 ms·
You don't need to "(...) have to copy the entire node_modules along (...)" when deploying, you can bundle backend code as well.
by mirekrusin 3y ago
You don't need to "(...) have to copy the entire node_modules along (...)" when deploying, you can bundle backend code as well.
- syspec 3y agoInteresting, Would you mind elaborating a bit?
- mirekrusin 3y agoWhen you think about how to enforce lockfile on monorepo it comes up as one of solutions. Many people don't realize that you can enforce only single lockfile (ie. at the root of your monorepo, any other lockfiles will be ignored). One of colleagues proposed and implemented elegant solution based on bundling backend code - that's what ends up in container image when it's built. It works very well for us. You end up with minimal, tree shaked code (with mapfile of course <<which can be inlined>>) in your production containers, which resembles go-like single binary builds which are reproducible.
- skwee357 3y agoTheoretically, nothing prevents you from running `npm install` inside the specific package. Do you have any other approach?
- mirekrusin 3y agoYou'll loose lockfile pinning/reproducibility if you do that.