My scenario is that I would like to debug TypeScript with serverless-offline and without serverless-webpack (I was having trouble with the source mapping).
So being able to disable the webpack plugin during development, would streamline the workflow
So I guess I would not need this feature if I solved the webpack issue, but debugging without webpack is faster to build too.
I see. That does make sense, and I can understand why you would want that. Unfortunately, it doesn’t really fit with how the Framework works given the plugin loading structure. Sorry about that – your best bet is just to comment out that plugin when needed.
Why not always run the plugin, and then inside the plugin access the environment from the options object? You can then conditionally run the plugin logic.
If you don’t want to define for which environment it should run within the plugin, you could also do this within serverless.yml and then have the plugin lookup if it should run or not based on the given environment. Something like
custom:
yourPlugin:
prod:
enabled: true
Indicating that it would only run its logic if the stage equals prod.