Closed jlarmstrongiv closed 5 years ago
A workaround is to lazy-load sharp - don't require it in the main instantiation chain for the entry-level class. So require and load it inside a function that actually uses it.
Claudia needs to instantiate the API class to read the configuration, so the current design makes it impossible to skip validation.
This package solved my problems https://github.com/sindresorhus/import-lazy#usage-with-bundlers though this stage-4 dynamic import feature will be more future-proof (example 1, 2). Use optional dependencies for development mode.
thanks. lazy load works for sharp.
Expected behaviour: Claudia packages and publishes my lambda function.
What actually happens: It errors out during package validation, saying
Sharp is a module I put into Lambda Layers.
Link to a minimal, executable project that demonstrates the problem:
Steps to install the project:
Steps to reproduce the problem:
I understand why claudia is throwing errors. I do not actually have that module installed. It is actually installed inside the Lambda Layer, which the package validator has no knowledge of.
It would be great to either pass an array of packages included in lambda layer to ignore validation errors for those packages. Or, as a quickfix, just skip the validator when using Layers. There’s probably other solutions I am unaware of.
Adding sharp as a dev or optional dependency did not work.