Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hoisting + Packaging Issue #6

Open
AmberDean opened this issue Nov 15, 2018 · 2 comments
Open

Hoisting + Packaging Issue #6

AmberDean opened this issue Nov 15, 2018 · 2 comments

Comments

@AmberDean
Copy link

I've tried out your example and noticed that the camelcase dependency for the "random" package doesn't actually get hoisted.

When you add a dependency that does get hoisted, ie bluebird, it seems to break serverless' packaging logic. Serverless depends on 'npm ls --production=true --parseable=true' when it is excluding dev dependencies. It looks like the 'npm ls' command gets confused when it tries to find @org/random's new bluebird dependency, since it is hoisted and does not exist in @org/random/node_modules, even though it is in sls-random/node_modules.

My current workaround is to manually build my own list of 'include' files, write the list to a json file, and then reference that json file in the serverless.yml file.

@tommedema
Copy link
Owner

@AmberDean I believe I'm aware of this issue, it's noted under known issues in the readme

Is this similar to your workaround? e0f97a0

@AmberDean
Copy link
Author

I ended up taking a different approach where I recursively parsed the package.json files for production dependencies, built a json file, and referenced that file when setting the package configuration.

package:
  include: ${file(include.json):paths}
  exclude:
    - ./**
    - '!dist/**'
  excludeDevDependencies: false

I'm guessing that your method is more robust than mine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants