【发布时间】:2015-12-29 10:02:14
【问题描述】:
我正在学习angular2 + es6。
我在使用gulp 构建时遇到问题。
我从https://github.com/shuhei/babel-angular2-app 克隆了一个简单的应用程序,在构建时,它使用babelify 将所有文件映射到一个文件bundle.js,它运行良好,但我无法调试。
结构
gulpfile
import gulp from 'gulp';
import gutil, { PluginError } from 'gulp-util';
import source from 'vinyl-source-stream';
import buffer from 'vinyl-buffer';
import browserify from 'browserify';
import watchify from 'watchify';
import babelify from 'babelify';
import del from 'del';
gulp.task('copy', () => {
return gulp.src('src/index.html')
.pipe(gulp.dest('public'));
});
gulp.task('build', ['copy'], () => {
const b = browserify('src/index.js')
.transform(babelify);
return bundle(b);
});
gulp.task('default', ['copy', 'watch']);
function bundle(b) {
return b.bundle()
.on('error', (e) => {
console.error(e.stack);
})
.pipe(source('bundle.js'))
.pipe(buffer())
.pipe(gulp.dest('public'));
}
如何构建一个我可以调试的结构。
例如:结构
请帮助我。 谢谢,
【问题讨论】: