Performance: Installing packages (dependencies vs devDependencies)
MEDIUM IMPACT
This concept affects the bundle size and load time of your application by controlling which packages are included in production builds.
npm install --save react react-dom
npm install --save-dev react react-dom
| Pattern | Bundle Size Impact | Load Time Impact | Runtime Errors | Verdict |
|---|---|---|---|---|
| Installing runtime packages as devDependencies | Excluded from bundle | Causes runtime errors or missing code | Yes | [X] Bad |
| Installing runtime packages as dependencies | Included in bundle | Loads correctly and fast | No | [OK] Good |
| Installing build/test tools as dependencies | Increases bundle by 100-300kb+ | Slows load and parse time | No | [X] Bad |
| Installing build/test tools as devDependencies | Excluded from production bundle | No impact on load time | No | [OK] Good |