Properly classify dependencies in package.json according to their usage pattern and project guidelines. This ensures correct build behavior, optimizes package size, and prevents dependency conflicts.
Properly classify dependencies in package.json according to their usage pattern and project guidelines. This ensures correct build behavior, optimizes package size, and prevents dependency conflicts.
Example of correct dependency classification:
// package.json
{
"dependencies": {
// Only runtime requirements
},
"peerDependencies": {
"@libsql/client": "^0.14.0" // Optional integration
},
"devDependencies": {
"@libsql/client": "^0.14.0", // Also needed for testing
"@cloudflare/workers-types": "^4.20240502.0" // Types only
}
}
For third-party integrations, follow the project’s integration guidelines to determine the appropriate dependency type. Avoid adding dependencies when equivalent functionality exists natively.
Enter the URL of a public GitHub repository