【发布时间】:2015-05-19 12:40:32
【问题描述】:
我正在使用 browserify 和 babel 编译我的 js 文件,我也想要 ng annotate 插件,但是它不起作用,有什么想法吗?
gulp 任务:
browserify(config.js.src, { debug: true })
.transform(babel.configure({ ignore: /vendor\// }))
.bundle()
.pipe(source(config.js.mainFileName))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(ngAnnotate())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.js.dist));
class HomeController {
// @ngInject
constructor($http) {
this.name = 'avi';
}
}
export default HomeController;
【问题讨论】:
-
“不工作”是什么意思,会发生什么?
-
它没有发生,dist 代码中没有 $inject。
-
为什么不在 browserify 转换之前运行 ng-annotate?
标签: javascript angularjs gulp