Bun v1.0.0 --production flag and optionalDependencies pruning
0 reputation · 27 Dec 2022, 03:39 UTC
Reducing Deployment Footprint for Low-Traffic Workloads
Bun v1.0.0 introduces the --production flag for bun install to optimize deployment footprints by excluding devDependencies. This is particularly useful for reducing disk I/O and startup latency in containerized or serverless environments where hosting costs are tied to resource usage.
Dependency Management Constraints
While the --production flag handles the removal of development dependencies, the current behavior regarding other dependency types is less restrictive. Specifically, optionalDependencies are installed by default, and peerDependencies are not automatically pruned during the production install process.
For workloads requiring the absolute minimum node_modules size to lower operational costs, it is unclear how to programmatically exclude optional dependencies without manually editing the package.json or employing external pruning scripts.
- Does Bun provide a configuration setting to skip
optionalDependencieswhen using the--productionflag? - Is there a documented method to prune
peerDependenciesthat are not required by the production runtime?