serverless-plugin-typescript: Don't copy devDependencies

there is an issue about this problem but it’s closed. https://github.com/graphcool/serverless-plugin-typescript/issues/13

Some other ppl and I still have the problem in that issue. So just to reopen it here.

package.json

{
  "name": "aws-credentials-exp",
  "version": "1.0.0",
  "description": "",
  "main": "handler.js",
  "dependencies": {
    "aws-sdk": "^2.201.0"
  },
  "devDependencies": {
    "serverless-plugin-typescript": "^1.1.5"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

serverless-plugin-typescript is not in the final release, but typescript and the dependencies of typescript do.

I tried not to include serverless-plugin-typescript plugin in serverless.yml (it’s still installed and exist in package.json), the node_modules in zip file will only have aws-sdk and its dependencies.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 10
  • Comments: 16 (6 by maintainers)

Commits related to this issue

Most upvoted comments

I can get dependencies excluding correctly by downgrading to npm 5.0.4. Anything higher and only top level is excluded.

npm install npm@5.0.4 -g

I really need this issue fixed. I see that there are several pull requests to fix this. May we have them merged?

Thank you!

🎉 This issue has been resolved in version 1.1.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

I’m also seeing this issue on on both my dev box (macOS High Sierra) and in the build container (node:carbon-alpine). Both are using: npm: 5.6.0 sls: 1.27.2 serverless-plugin-typescript: 1.1.5 yarn: 1.6.0

I’m seeing the same symptoms where npm ls --dev=true --parseable=true --long=false --silent returns the full list when run in the service directory and returns only the top-level dev dependencies in .build

This breaks due to the symlinking, at least on Windows.

Serverless runs this command to discover dependencies.

npm ls --dev=true --parseable=true --long=false --silent

Try running that command in the project’s root, then cd .build and do it again. All transitive dependencies are missing from the latter invocation. (You need to do this when the .build/node_modules symlink exists)