Using `serverless function run`
thenikso opened this issue · comments
Hey there! Gz for the update for v0.5.
So I'm in the process of setting it up. First of, I think that the readme should specify that in the s-function.json
one should have "runtime": "nodejs",
.
Second I tried serverless function run myfunc
and I of course get an error because the js code is not going through babel (nor webpack). How could we solve this?
Thanks!
As I mentioned in #10 this plugin is not a runtime, meaning that it doesn't change how Serverless runs your code. I think that unless you have a complex webpack.config.js then serverless-runtime-babel might fit your needs better. It assumes that you use babel and will allow you to run and build (with browserify) your code.
I fixed #10 so as not to leave everyone high and dry but I am unsure whether building a generic webpack runtime is a good idea. Doing a full build with webpack simply to run your function seems clunky and assuming you are gonna use babel/register to run seems like it should be some sort of babel-webpack runtime.
If I have time later this week I may try out the idea of a babel-webpack runtime.
I've also been trying to run functions with webpack. I ended up making this https://github.com/elastic-coders/serverless-runtime-webpack
I actually like the idea of building with webpack every time I run the function locally as I get a better understanding of how the build will go.