这是我的gulpfile.js
var gulp = require( "gulp" ),
traceur = require( "traceur" ),
babel = require( "babel" ),
plumber = require( "plumber" ),
es6Path = "es6/*.js",
compilePath = "es6/compiled";
gulp.task( "traceur", function () {
gulp.src( [ es6Path ] )
.pipe( plumber() )
.pipe( traceur( { blockBinding: true } ) )
.pipe( gulp.dest( compilePath + '/traceur' ) );
});
gulp.task( "babel", function () {
gulp.src( [ es6Path ] )
.pipe( plumber() )
.pipe( babel() )
.pipe( gulp.dest( compilePath + '/babel' ) );
});
gulp.task( "watch", function() {
gulp.watch( [ es6Path ], [ "traceur", "babel" ] );
});
gulp.task( "default", [ "traceur", "babel", "watch" ] );
这是我的package.json文件。
{
"name": "ES6Demos",
"version": "1.0.0",
"description": "Getting started wtih ES6 using gulp",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Vinayak Phal",
"license": "ISC",
"devDependencies": {
"gulp": "^3.9.0",
"gulp-babel": "^5.2.1",
"gulp-concat": "^2.6.0",
"gulp-plumber": "^1.0.1",
"gulp-traceur": "^0.17.1",
"gulp-typescript": "^2.9.0",
"gulp-uglify": "^1.4.1"
}
}
安装了所有依赖项和所有内容,但我仍然收到以下错误。
这不仅适用于traceur,它也会给其他模块带来错误。 无论哪一个接近吞咽。
答案 0 :(得分:1)
您需要" traceur"。你需要要求" gulp-traceur"。其他包也一样。