vercel / micro

Asynchronous HTTP microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxError: Unexpected token import

runegame opened this issue · comments

With micro@8.0.2 when I use import/exports from ES6 throws exception:

SyntaxError: Unexpected token import

when i run this command:

micro -p 5000 pictures.js

I uninstall this version and install micro@4.1.1 then work for me in Node 8.4.0

I wish use the last version of micro in my project. What dou you recommend to resolve this issues?

Micro doesn't transpile your code, you need to manually use Babel if you want to support ESM instead of CJS. I personally recommend you to stay with CJS and Node.js supported features to avoid transpiling.

OK thank you very much. I solved installing micro@4.1.1 but I think I will have to use CJS to avoid being in that version