Open gabsn opened 3 years ago
Hi @gabsn, I have in mind to implement this similar way like serverless-webpack
does, but cannot currently focus on it. I would appreciate your effort if you're willing to contribute.
Sorry finally I decided to go with serverless-scriptable-plugin
and:
scriptable:
hooks:
# serverless
before:deploy:deploy: yarn build
before:invoke:local:invoke: yarn build
# serverless-offline
before:offline:start: yarn dynamodb:start & yarn watch &
Then in my build command I can use esbuild with its native config.
After looking for
lifecycleEvents
in the source code, I didn't find any hookable events I could use to customize theserverless-esbuild
plugin behavior.However it is common best practice to expose such events when you write a plugin (See here).
For example,
serverless-offline
exposesinit
,ready
andend
event thatserverless-esbuild
actually uses to build the module before launching serverless-offline (See here).I would need this hook to copy some static assets before bundling the package with
esbuild
.Let me know if you want me to open the PR.