As Node V6 already supports ~95% of ES6, why are people using Babel on the server side? What are the pros and cons of using Babel on the server side?
            Asked
            
        
        
            Active
            
        
            Viewed 663 times
        
    4
            
            
        - 
                    1I'm quite sure it's ok to do but for the most part unnecessary. It may be a carry over from working with the browser and folks not realizing it's not needed on node. I can't say for sure though and hence this is a comment instead of an answer. – Frank V Feb 24 '17 at 15:26
- 
                    Did [my answer](https://stackoverflow.com/questions/42442290/is-it-ok-to-use-babel-npm-package-for-node-js-server-application/42442403#42442403) below answer your question? Any comments? – rsp Jul 18 '17 at 17:20
1 Answers
3
            
            
        There is one main reason: import / export
See:
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/export
There is even a special Babel preset for Node:
that doesn't transpile anything that Node already supports natively.
You can also use babel-preset-env which is "A Babel preset that can automatically determine the Babel plugins and polyfills you need based on your supported environments" - thanks to loganfsmyth for pinting it out in the comments. See:
And Node doesn't support ES6 modules - see this answer for details on why:
- 
                    These days the community has mostly moved from `babel-preset-node6` to `babel-preset-env`. – loganfsmyth Feb 24 '17 at 17:57
 
     
    