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

Support transient dependencies when bundling (whitelisting) node modules #186

Merged
merged 1 commit into from
Aug 9, 2017

Conversation

HyperBrain
Copy link
Member

What did you implement:

If you add a node module to the whitelist of node-externals, the module is bundled and the module's dependencies are added to the externals of the compiled chunk.
The current version of the plugin checks all externals against the production dependencies of the service, so the "new" externals are not found there and are missing in the deployed functions. The functions will crash with a missing modules exception.

This PR fixes the issue, and adds all transient dependencies to the functions in case a node module is bundled.

How did you implement it:

The packager now fetches the dependency tree of the service by using npm ls, tries to find the used module versions and adds them to the deployed module list.

The existing handling for first level modules that are present in the package.json has not been changed, so for the existing uses nothing special should be expected.

I tested it thoroughly with a combination of bundling some node modules fetched from VCS (GIT) - this would be the most prominent use case.

@HyperBrain HyperBrain added this to the 3.0.0 milestone Aug 9, 2017
@HyperBrain HyperBrain merged commit c6e76b4 into v3.0.0 Aug 9, 2017
@HyperBrain HyperBrain deleted the install-bundled-dependencies branch August 9, 2017 17:25
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

Successfully merging this pull request may close these issues.

1 participant