floydspace/serverless-esbuild

Rewrite Module Packaging Logic

Opened this issue · 3 comments

Is your feature request related to a problem? Please describe.

Hello! I'm back for business.

  1. The current logic with packaging modules is very complicated. I would know as I wrote most of it 😪 Having looked through some of the CDK esbuild logic I like what they've done and instead of trying to determine what modules to package based on npm ls or yarn list they instead simply create a fake package.json and run the equivalent install command. This should make supporting newer and future bundlers simpler.

  2. I would like to add per function external and exclude logic. I think excluding deps because we can't detect them being used in a function is error prone so we should instead encourage users to use per function excludes if they choose to package individually.

  3. Add support for pnpm.

Describe the solution you'd like
A clear and concise description of what you want to happen.

Described as above

Describe alternatives you've considered
N/A

Additional context
Add any other context or screenshots about the feature request here.

I'd also like to improve lifecycle hooks, add new hooks like before/after bundle, before/after package, etc.

for ref: #158

it could be a valuable step toward the serverless-esbuild v2

I'll look to raise some PRs just shortly after the new years, in case someone is wondering.