2

I am new to the web development and I am going to write an web application in JavaScript (Node, Webpack, ...). With the use of Babel, it is easy to make ES8 code compliant with any browsers. However, if I decide to publish some part of my code as npm modules, few users would certainly prefer me to use ES6 or older.

The code I am going to write will be based on Vue.js and Express 4, but again with Babel, I can use any version of JavaScript and it will work.

What ECMAScript version should I use to develop my Web Application (<= ES6, ES7, ES8)?

Should I target JS6?

Disclaimer: I am not asking for a primary opinion. I would like to rely on facts that tell me not use ECMAScript 1 from 1997 because, well I am sure there are reasons for that...

nowox
  • 25,978
  • 39
  • 143
  • 293
  • "I am not asking for a primary opinion." — You really are. – Quentin May 20 '18 at 15:01
  • "I would like to rely on facts that tell me not use …" — Then ask a question where the answer is one of those facts. – Quentin May 20 '18 at 15:01
  • @nowox I am sorry but as far as I know, this question will be closed, because its not a programmatic problem. Its something which one can google and read various articles and comparisons about the various JS versions. – nobalG May 20 '18 at 15:03
  • 1
    It is really a programmatic problem to know if I whould write `foo ((req, res) => { ... })` or `foo (function (req, res) { ... }`. If I should avoid promises. If I should use or not `let` and `var`... – nowox May 20 '18 at 15:04
  • @nowox : Just google it. 80% of people who (if this isn't closed) when they answer will google it and then write the answer by citing various article – Muhammad Salman May 20 '18 at 15:05
  • 1
    @nowox — All else being equal, that's a matter of opinion. If you wanted to know the difference between then, then that would be fact based (and [a duplicate](https://stackoverflow.com/questions/34361379/arrow-function-vs-function-declaration-expressions-are-they-equivalent-exch)), but that isn't what you are asking. – Quentin May 20 '18 at 15:05
  • @nowox : It is a problem if you are asking a valid question. Take a look at [this](https://stackoverflow.com/help/dont-ask) – Muhammad Salman May 20 '18 at 15:06
  • Taking for example the same question related to `C` programming which I have more expertise. I would answer it with facts: For C programming you should use `ISO/IEC 9899:2011` as it is the latest standard released by ISO, and all modern compilers support this standard. However if you target an embedded application with the use of a specific compiler that does not support this standard you should prefer `ISO/IEC 9899:1999`. – nowox May 20 '18 at 15:07
  • "For C programming you should use ISO/IEC 9899:2011" — That's an opinion. "as it is the latest standard released by ISO" — That's a fact. Just because you formed your opinion because you knew a fact doesn't mean it isn't an opinion. – Quentin May 20 '18 at 15:10
  • @Quentin, well, so you would see no problem to use ECMAScript 1997 to write a new application? Instead of arguing that I am a jerk to write such primary opinion question, could you please help me by giving some useful hints? And by the time this question will be closed, you would have helped me. – nowox May 20 '18 at 15:12
  • @nowox : For example , I answer the question saying use ES2015 since it is new and yada yada yada. But all of these are opinions interlaced with facts. And the question is still opinion based – Muhammad Salman May 20 '18 at 15:13
  • Why not ES2017? – nowox May 20 '18 at 15:14

1 Answers1

2

Here an attempt to partially answer my own question (and try to not give a primary opinion)

Currently, node does not support import as it is part of ECMAScript 2015 (ES6) standard. It means you must translate your source-code using Babel. This is not an issue on its own, but it becomes quite annoying when you want to debug your code.

For instance when you start an inspect session with babel-node --inspect-brk server.js you will see the translated code into the debugger. This could slow down the development somehow.

ES2015 support is monitored here: https://node.green/. Notice that the nightly build of Node.js 11.0.0 is still not fully compliant with ES6.

nowox
  • 25,978
  • 39
  • 143
  • 293
  • Delivering raw source is always a mess. A transpiler will ensure browser compatibility, polyfilling when a feature is not natively supported. You should use the latest the language has to offer, as it has evolved to be more expressive. – mmmveggies Jun 13 '19 at 20:42