Open thekevinbrown opened 4 years ago
Hi, sorry for long delay. The default installation method runs npm install --production
so it should exclude dev dependencies, although I have note actually tested it. I also just added an option to override the npm install
command in case customization is needed.
In our case it seemed to just take the node_modules
folder and push it up. Since this was part of an existing project and I run npm i
before I build, this was everything.
Should we be managing our lambdas outside of the folder structure of the project? That seems kind of odd to me.
Hmm.. What is supposed to happen is this sequence:
project_dir/lambda
(basically any path)project_dir/lambda/tsconfig.json
and project_dir/lambda/package.json
TypeScriptCode.asset('project_dir/lambda')
tsc --project project_dir/lambda --outDir project_dir/lambda/.deploy
copyFiles
entries to project_dir/lambda/.deploy
package*.json
to, and run npm install
in, project_dir/lambda/.deploy
project_dir/lambda/.deploy
will contain the fully built Lambda function codeproject_dir/lambda/.deploy
to AWS CDK for deploymentproject_dir/lambda/.deploy
contains the correct filesIf it runs npm install
in step 6, then that'll include dev dependencies, but since you mentioned --production
above that's probably not it.
Either way, our experience was that dev dependencies were included. Would a reproduction help here?
It would be most helpful to understand if something is wrong with the command line that is used to run npm install:
Or maybe with some other logic in how the module works?
Alrighty, I'll make up a repro when I get a chance.
Is there any way to exclude dev dependencies from the deployed package when using this?