serverless / serverless-optimizer-plugin

Serverless Optimizer Plugin: Optimizers for reducing Lambda file sizes and improving their performance -
http://www.serverless.com
102 stars 30 forks source link

Optimize lib on local run #18

Open madmod opened 8 years ago

madmod commented 8 years ago

When I try sls function run ... I get the error Serverless: SyntaxError: Unexpected token import whenever I reference my files in my components lib folder which are ES6. Deploying to AWS works fine but I am unable to test locally. Unfortunately running with --debug does not give any more info about the error.

pho3nixf1re commented 8 years ago

I am having the same issue, could it be that the optimizer doesn't run when ran locally? Maybe there needs to be a flag or something to allow it?

madmod commented 8 years ago

I currently use the serverless-serve plugin to workaround the issue which has an option to use Babel for ES6 and works with the lib folder.

patoncrispy commented 8 years ago

Yeah I've just come up against this problem, too. As much as I love writing in ES6 syntax, I think I'll just switch back until the Serverless team (who are doing an incredible job, by the way!) are able to get around to this. :)

elldritch commented 8 years ago

If you just want to check the optimised output, you should also take a look at https://github.com/HyperBrain/serverless-package-plugin