Closed sethkrasnianski closed 8 years ago
Doesn't seem like an issue with roots-browserify specifically. Other transforms work fine, are you sure this isn't a problem with the transform or the way you are passing it in?
Also you can just npm install babel and use a .jsx
file extension to have it to its thing.
The issue here is that Babel as of 6.0.0 ships with no presets. It won't compile your code the way you expect without the es2015 preset.
@sethkrasnianski the solution to this is to npm install babel-preset-es2015
and then in app.coffee
do
babelify = require('babelify').configure({ presets: ['es2015'] })
module.exports =
extensions: [
browserify(files: 'assets/js/main.js', out: 'js/my-file.js', transforms: babelify)
]
:+1: Sounds like a solution. I'll close this for now.
When using the following app.coffee, babelify is ignored and doesn't transform the es6 code to es5.
It transforms this
to this