javascriptnode.jsreactjsbabeljsviewengine

Do I need to use Babel in project which created backend service with Node.js and front end part with view engine with ejs?


I am a little bit confused. Someone says If you are going to develop pure Node.js projects, you don't have to worry about this. For web you should be aware of all of these tools. Someone says if you need to minimize production code use it.

Purpose of using babel is, it converts edge JavaScript into plain old ES5 JavaScript that can run in any browser.

  1. So, do I need to use Babel in project which created only for the backend service with Node.js?

  2. Do I need to use Babel in project which created backend service with Node.js and front end part use render with view engine (ejs, jade ...)?

  3. Do I need to use Babel in project which created backend service with Node.js and front end part with React?


Solution

    1. You can not use if you will start from the latest stable version, but if after e.g. a year you will want to use new features of js like optional chaining, you will either need to update version of node, which can be risky(breaking changes of node api, dependencies which works with fixed version) or use babel and just change config because it's much less risky.

    2. You need at least for generated part, because even with view engine you will include javascript in this pages, but also I advice to use even for node

    3. For node js part react p1, for react I advice you to use if you want to support older browsers, if not, at least for reason 1), you will can't use new features of javascript because you locked on current browser version.

    Also babel have an amazing feature which allow for you just select browser versions, not es5/es6/esnext and it will transpile accordingly.