question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

excludeDevDependencies is not working when package points to parent directory

See original GitHub issue

Are you certain it’s a bug?

  • Yes, it looks like a bug

Is the issue caused by a plugin?

  • It is not a plugin issue

Are you using the latest version?

  • Yes, I’m using the latest version

Is there an existing issue for this?

  • I have searched existing issues, it hasn’t been reported yet

Issue description

Serverless version: ^2.71.0

I decided to move my serverless.yml files into separated folder, and inside it point to the root folder:

|*root*
|-/infrastructure
|---serverless.yml
|-/src
|----*all code*

I can point serverless to include code from parent dir by using either include or pattern options in package section. However, in this case all node_modules gets included, even dev deps, even if you provide excludeDevDependencies: true in package section.

So I can either include all dependencies, or exclude entire node_modules, nothing more (obviously, I can manually exclude some node modules, but this would be hell).

Service configuration (serverless.yml) content

service: service-name
package:
  individually: true
  excludeDevDependencies: true
  include:
    - "../../../**/*"
  exclude:
    - "../../../tests/**"
    - "../../../infrastructure/**"

functions:
  processUpdate:
    name: function-name
    handler: ./src/lambdas/processUpdate.handler

Command name and used flags

serverless deploy

Command output

Output is normal deployment output, with huge s3 .zip file.

Also, i'm on Windows 10, and inclusion of all node_modules sometimes fails into "EMFILE: too many open files"

Environment information

Framework Core: 2.71.0 (local)
Plugin: 5.5.3
SDK: 4.3.0
Components: 3.18.1

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
pgrzesikcommented, Jan 31, 2022

Hello @vssenko - thanks a lot for reporting. At the moment, exclusion of dependencies is always run against the node_modules placed in service directory, which in your case would be inside the infrastructure folder. I will bring this topic up during the internal meeting and will report back.

0reactions
vssenkocommented, Feb 1, 2022

Thank you all for being so responsive! I hope this new feature will be deployed soon!

Read more comments on GitHub >

github_iconTop Results From Across the Web

serverless framework - How to use excludeDevDependencies?
The problem is excludeDevDependencies only works fine when I comment the exclude - node_modules/** . It will generate .serverless directory and ...
Read more >
Serverless Jetpack - Serverless Framework: Plugins
So how do we fix the problem? A first starting point is to generate a full report of the packaging step. Instead of...
Read more >
rollup.js
When this file contains imports, Rollup will try to resolve them relative to the current working directory. When using a config file, Rollup...
Read more >
Add ability to optionally ignore dev dependencies in NPM ...
Problem to solve When running Dependency Scanning on Node. ... For instance, in a project having the following package.json dependency file, ...
Read more >
window-pain - npm Package Health Analysis - Snyk
In the past month we didn't find any pull request activity or change in issues status has been detected for the GitHub repository....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found