I think we could use es6 syntax, by adding babel.
I know that it is complicated for beginners but the ones who are experienced with it could set it up for general use.
The es6 syntax is more readable I believe.
I have myself created a cli for these kind of things it could be used to initialize es6 projects :)
my cli -> link
I'm not trying to promote anything, just to be helpful for beginners 馃檪
Why can't we simply write in ES6 format without the need for Babel? We should target new browsers [most now support ES6 - ECMA 2015 nowadays anyways].
I don't see the need for Babel here. Care to explain?
@tolgaerdonmez this is very helpful
Why can't we simply write in ES6 format without the need for Babel? We should target new browsers [most now support ES6 - ECMA 2015 nowadays anyways].
I don't see the need for Babel here. Care to explain?
As far as I know, nodejs doesnt support es6 format itself.
@tolgaerdonmez this is very helpful
thanks
@tolgaerdonmez Ah right! I totally forgot. My bad!
Why can't we simply write in ES6 format without the need for Babel? We should target new browsers [most now support ES6 - ECMA 2015 nowadays anyways].
I don't see the need for Babel here. Care to explain?
As far as I know, nodejs doesnt support es6 format itself.
Or supports as far as es8 minus the imports. Wet don't transpiler for node
In order to write es6 syntax such as import from etc, I would like to propose installing a npm package like esm. This takes care of converting from es6 to regular JS standard to run the scripts.
https://www.npmjs.com/package/esm.
Once it is installed and part of package.json, we can then use it as a script in package.json as:
"start": "node -r esm <file>.js"
@aravindsivasailam create a PR with a example and read me file.
Create a folder inside playground/cli
Most helpful comment
In order to write es6 syntax such as
import frometc, I would like to propose installing a npm package likeesm. This takes care of converting from es6 to regular JS standard to run the scripts.https://www.npmjs.com/package/esm.
Once it is installed and part of package.json, we can then use it as a script in package.json as:
"start": "node -r esm <file>.js"