serverless-optimizer-plugin icon indicating copy to clipboard operation
serverless-optimizer-plugin copied to clipboard

Optimize lib on local run

Open madmod opened this issue 8 years ago • 4 comments

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.

madmod avatar Feb 16 '16 00:02 madmod

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?

pho3nixf1re avatar Feb 18 '16 04:02 pho3nixf1re

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.

madmod avatar Feb 18 '16 04:02 madmod

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. :)

patoncrispy avatar Mar 05 '16 19:03 patoncrispy

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

elldritch avatar May 25 '16 23:05 elldritch