floydspace / serverless-esbuild

💨 A Serverless framework plugin to bundle JavaScript and TypeScript with extremely fast esbuild
MIT License
451 stars 139 forks source link

feat: watch mode for invoke local #248

Open vicary opened 2 years ago

vicary commented 2 years ago

Developers would usually wants to save time by invoking a single function with a few designated inputs.

Since watch mode is already supported for serverless-offline, is it possible to also add this for invoke local for quick developments?

samchungy commented 2 years ago

Hmm doesn't invoke local immediately invoke the function? How would a watch function work here? Would you want it to immediately be invoked?

With serverless-offline, correct me if I'm wrong but it exposes a localhost port which you call manually later? Hence why the watch function is handy because we would update the code to be called.

I feel you could achieve this easily enough with nodemon?

vicary commented 2 years ago

Hmm doesn't invoke local immediately invoke the function? How would a watch function work here? Would you want it to immediately be invoked?

Once immediately, and then every time related sources are modified. It will be a long-running process.

With serverless-offline, correct me if I'm wrong but it exposes a localhost port which you call manually later? Hence why the watch function is handy because we would update the code to be called.

Yes. My functions are largely AppSync resolvers and cron handlers. I would prefer running off predefined event objects and invoke locally, this favors unit tests without setup/teardown of a local web server.

I feel you could achieve this easily enough with nodemon?

Yes, but it makes a different between zeroconf and little-conf. It'd be perfect if custom.esbuild.watch can be shared with this new feature.

Vissie2 commented 10 months ago

I realize this issue is a bit old but I wanted to elaborate that people could run into this when migrating from serverless-plugin-typescript as that package supports it. At most times implementing a custom filewatcher is not a big deal though.