Nodejs and ES6

Times when I use ES6 feature in nodejs and run it, encounter the problem of “SyntaxError: Unexpected token import”

nodejs official document have elaberate it at here

if you want some ES6 feature that not stable in V8 engine, use –harmony flag but not recommend.

see the feature and support of the v8 version.

About ES6 Module. from here, the import syntax have not been supported yet.

but you can use babel to use the import/export syntax.

Total views.

© 2013 - 2023. All rights reserved.

Powered by Hydejack v6.6.1