Babel does not change decorators

Forgive me if I miss something obvious, I'm relatively new to javascript, ES2015, etc.

I have a gulp task to run gulp-babelon top of my application Aurelia. Everything works and works, with the exception of files containing decorators (Aurelia @inject)

these files spit out the same error in gulp -notify:

Error: ( file path ) /nav-bar.js: AssignmentExpression ownership is expected to be node for type ["Expression"], but instead got "Decorator"

I am not sure how to start this decision. My task looks like this:

 gulp.task('build-system', function () {
    return gulp.src(paths.source)
          .pipe(plumber({errorHandler: notify.onError("Error: <%= error.message %>")}))
          .pipe(changed(paths.output, {extension: '.js'}))
          .pipe(sourcemaps.init({loadMaps: true}))
          .pipe(babel(compilerOptions))
          .pipe(sourcemaps.write({includeContent: true}))
          .pipe(gulp.dest(paths.output));
 });

and my compilerOptions:

 module.exports = {
   moduleIds: false,
   comments: false,
   compact: false,
   presets: ['es2015'],
   plugins: ['syntax-decorators', 'transform-decorators']
 };

Any understanding would be greatly appreciated!

+4
1

, Babel v6. ( presets: ['es2015'])

babel v5.x( ), .

Babel Phabricator. , .

+6

Source: https://habr.com/ru/post/1614539/


All Articles