There is a major pain I’m trying to think how to handle.
I have a layer that injects some common nodejs modules. This layer is attached to some lambda I have. Now when I write my lambda code that relies on that package, I also import the package at the top of the file.
What happens then is that Pulumi attempts to bundle that package into my lambda code, even tho the only reason I have it installed is so I can create a layer with this module. How can we tell Pulumi not to bundle this package?
Also, Pulumi does not respect tree-shaking and bundles the entire package even if I’m using a subset of the package. Is my only option here is to pipe my code through a more “intelligent” such as webpack to do the tree-shaking for me?
05/05/2021, 3:21 PM
you’re using the CallbackFunction to provide your lambda code? If you want more fine-grained control over your lambda you can bundle it using the