user6819864
user6819864

Reputation: 23

Is it possible to run ES6 code in Babel without transpiling it to ES5

How would I run or execute a code in ES6 using the Babel engine or module in Node Js, without trans-piling it to ES5.

Upvotes: -1

Views: 1555

Answers (2)

Hamed Navvabian
Hamed Navvabian

Reputation: 792

Node JS and browsers support ES6. But for using additional features you have to first configure babel with .babelrc and also add npm scripts for building your project to ES5, then run it with node js or browser.

Follow the instruction

Upvotes: 1

Juhil Somaiya
Juhil Somaiya

Reputation: 953

As per my understanding, we don't use Babel for running a code. In simple words it is a transpiler that converts the modern ES2015/ES6 code to the browser understandable js code, while now a days most of the browser supports ES6.

Node.js is a js run-time where you can run your javascript file and which natively supports ES6 implementation.

You can directly run your script file using node command as below, you don't require transpiler/Babel to run it.

node yourScript.js

Upvotes: 0

Related Questions