Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

serverless-esbuild should expose lifecycle events to be hookable #158

Open
gabsn opened this issue Jul 3, 2021 · 2 comments
Open

serverless-esbuild should expose lifecycle events to be hookable #158

gabsn opened this issue Jul 3, 2021 · 2 comments
Labels
enhancement New feature or request

Comments

@gabsn
Copy link

gabsn commented Jul 3, 2021

After looking for lifecycleEvents in the source code, I didn't find any hookable events I could use to customize the serverless-esbuild plugin behavior.

However it is common best practice to expose such events when you write a plugin (See here).

For example, serverless-offline exposes init, ready and end event that serverless-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.

@floydspace
Copy link
Owner

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.

@gabsn
Copy link
Author

gabsn commented Jul 23, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants