Buscar..


Usando gulp-babel y gulp-plumber

Ionic usa Gulp, así que instala gulp-babel y gulp-plumber.

npm install --save-dev gulp-babel gulp-plumber

Agrega babel a gulpfile.js así:

//...
var babel = require("gulp-babel");
var plumber = require("gulp-plumber");
 
var paths = {
  es6: ['./src/es6/*.js'],
  sass: ['./scss/**/*.scss']
};
  
gulp.task('default', ['babel', 'sass']);
 
gulp.task("babel", function () {
  return gulp.src(paths.es6)
    .pipe(plumber())
    .pipe(babel())
    .pipe(gulp.dest("www/js"));
});
  
//...
  
gulp.task('watch', function() {
  gulp.watch(paths.es6, ['babel']);
  gulp.watch(paths.sass, ['sass']);
});
//...

Editar ionic.project :

"gulpStartupTasks": [
    "babel",
    "sass",
    "watch"
 ],

Ahora, cuando ejecute el ionic serve , el código será transpilado para usted.



Modified text is an extract of the original Stack Overflow Documentation
Licenciado bajo CC BY-SA 3.0
No afiliado a Stack Overflow