serverless-s3-local
serverless-s3-local copied to clipboard
S3-local doesn't seem to work well with nodeJS 8.10
When I try to use this plugin combined with a project in NodeJS 8.10, I get all kinds of errors like
Unexpected token import
When I change all 'imports' into requires, the next error appeares:
Unexpected token export
And so on..
As soon as I remove this plugin, all errors are gone.
Anyone able to help me with this?
Hi @DaphneKerstens I think that "import" doesn't work correctly in node environment. Do you use babel or any transpiler ? If you use them, severless-s3-local doesn't work correctly. Because serverless-s3-local tries to load original javascript file.
ran into the same issue today. im running node env 8.10. im using serverless-webpack with babel. and serverless-s3-local seems not to load the transpiled files by webpack, instead it uses the original files.
is there any solution?
I just found a quick fix:
when I'm adding my webpack output location like: --location ./.webpack/service/
to my start command, it will take the transpiled files.
Though this should not be mandatory I guess? How do other plugins work with that?
@JuHwon Thanks for your great information. I think that the way you mentioned is good solution for this problem. And it inspired me. Eventually, I found a solution for this issue. This solution doesn't require extra command line options to find transpiled files. Please see the support-webpack branch. Unfortunately, this solution is not achieved with modification of itself. We have to modify serverless-webpack in itself. About this modification, please see support-serverless-s3-local brainch in my fork repository of serverless-webpack.
@JuHwon @DaphneKerstens In fact, the above branch version works correctly. So I released them as v0.3.7. Please install them via npm.
Still doesnt work with your updates @ar90n
Hi @devotox Thank for your comment and PR. I merged the PR. Please check it.