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
feat(lambda-nodejs): external and install modules #8681
Conversation
Add support for: * external modules: modules that should not be bundled. Defaults to `aws-sdk`. * install modules: modules that should not be bundled but included in the `node_modules` folder of the Lambda package. Those modules are installed in a Lambda compatible Docker image with the right installer (`npm` or `yarn`) based on lock file detection. Closes aws#6323
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor
``` | ||
|
||
#### Install modules | ||
Use the `installModules` prop to specify a list of modules that should not be bundled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a preface saying: "By default, Parcel will automatically detect all modules referenced in your lambda code and will include them in the lambda bundle. ..."
RUN npm install --global yarn | ||
|
||
# Install parcel 2 (fix the version since it's still in beta) | ||
RUN yarn global add parcel@2.0.0-beta.1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we allow people to select parcel version?
I wonder if we should change the API to something like this: const myFn = NodejsFunction.parcel(this, 'fn', { ... }); // static method and have the export interface NodejsFunctionProps extends lambda.FunctionOptions {
entry?: string;
handler?: string;
runtime?: lambda.Runtime;
code?: lambda.Code;
}
lambda.Code.fromAsset(path.dirname(entry), {
exclude: ['**', '!entry']
}); Also stumbled upon this https://github.com/vercel/ncc, which looks very interesting for this module. |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
Add support for:
aws-sdk
.the
node_modules
folder of the Lambda package. Those modules areinstalled in a Lambda compatible Docker image with the right installer
(
npm
oryarn
) based on lock file detection.Closes #6323
Closes #7912
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license