-
Notifications
You must be signed in to change notification settings - Fork 37
Closed
Labels
type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.
Description
Environment details
- OS: Mac Mojave
- Node.js version:
8.9.1|8.15.0|10.14.0 - npm version:
5.5.1|6.4.1 @google-cloud/commonversion:0.31.1
Steps to reproduce
- Create empty npm package:
npm init - Add @google-cloud/common as a dependency:
yarn add @google-cloud/common@0.31.1
We now have this package.json:
{
"name": "temp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"@google-cloud/common": "0.31.1"
}
}
- List all TypeScript typings from dependencies:
ls node_modules/@types:
caseless duplexify form-data node request tough-cookie
- Check why we have these:
yarn why @types/request
yarn why v1.13.0
[1/4] 🤔 Why do we have the module "@types/request"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "@types/request@2.48.1"
info Reasons this module exists
- "@google-cloud#common" depends on it
- Hoisted from "@google-cloud#common#@types#request"
info Disk size without dependencies: "28KB"
info Disk size with unique dependencies: "796KB"
info Disk size with transitive dependencies: "796KB"
info Number of shared dependencies: 4
✨ Done in 0.11s.
yarn why @types/duplexify
yarn why v1.13.0
[1/4] 🤔 Why do we have the module "@types/duplexify"...?
[2/4] 🚚 Initialising dependency graph...
[3/4] 🔍 Finding dependency...
[4/4] 🚡 Calculating file sizes...
=> Found "@types/duplexify@3.6.0"
info Reasons this module exists
- "@google-cloud#common" depends on it
- Hoisted from "@google-cloud#common#@types#duplexify"
info Disk size without dependencies: "16KB"
info Disk size with unique dependencies: "732KB"
info Disk size with transitive dependencies: "732KB"
info Number of shared dependencies: 1
✨ Done in 0.11s.
This adds 100's of KB of dependencies which could be avoided ifthe @types were in devDependencies instead of dependencies.
This is significant if you're using Cloud Functions because it will impact cold start times.
Metadata
Metadata
Assignees
Labels
type: questionRequest for information or clarification. Not an issue.Request for information or clarification. Not an issue.