Webpack is not packing dependencies into code

I’m using the aws-nodejs-typescript template, and I’m not sure what I’m doing wrong here. Basically, my deployed ZIP files are including node_modules in its entirety. But if I set webpack: { includeModules: false } }, it leaves out node_modules and doesn’t minify/bundle dependencies into the JavaScript code.

Am I missing something basic here?

I ran into some similar issues which i discussed here: Serverless Webpack Bundling Best Practices

I was never able to find an official answer, but it seems like the default approach where the node_modules folder is included in the deployment zip is the best practice. I think there are sometimes issues when webpack bundles things that are running server side.

I have somewhat of a solution in my previous post, where you specifically highlight to webpack to include some packages in the bundle, but this doesnt seem very robust to me, so I stayed with the default approach.