简体   繁体   English

gulp-angular-filesort支持ECMAScript 2015

[英]Support of ECMAScript 2015 in gulp-angular-filesort

How can I know which language features gulp-angular-filesort supports? 我怎么知道gulp-angular-filesort支持哪些语言?
I mean, I'm trying to add this line to a js file: 我的意思是,我正在尝试将此行添加到js文件中:

var [a1,a2]=[1,2];

and I get the following error: 我收到以下错误:

[10:27:24] [AngularFilesort] Error in plugin 'gulp-angular-filesort'

Message: Error in parsing: "main\\home\\welcome\\welcome.controller.js", Line 14: Unexpected token [ 消息:解析时出错:“ main \\ home \\ welcome \\ welcome.controller.js”,第14行:意外令牌[

I have this line in package.json: "gulp-angular-filesort": "~1.1.1", 我在package.json中有这行: “ gulp-angular-filesort”:“〜1.1.1”,
Is there a way to make this plug in work with new features of ecmascript? 有没有办法使此插件与ecmascript的新功能一起使用?

I had the same issue to make it work with ES6 code. 我有同样的问题要使其与ES6代码一起使用。

You'll need to pipe the stream with Babel, something like that: 您需要将流与Babel进行管道传输,如下所示:

.pipe(babel({ presets: ['es2015'] }))
.pipe(angularFilesort())

It worked for me. 它为我工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM