I read about stuff like this and then wonder whether I'll ever be able to use it since target browser platforms are so fragmented.
require('babel/register')
require('./main.js')
and carrying on like nothing ever happened.Apparently some people prefer to build a distribution of the entire project with Babel on deploy, which is fine, but it does cause an impedance mismatch with how projects are developed on the developer's machine; obviously both ways have to work.
A real problem with babel/register is the interface for including node modules, which I think needs improvement. You can't selectively include individual modules because the {only} option isn't additive, it replaces the default setting.
"browserify": {
"transform": [
"babelify"
]
}
...which is great, but Babel doesn't have anything like it for server-side stuff.