dal*_*ler 2 javascript browserify gulp babeljs
我开始打破一个Javascript客户端库,index.js
并有一个额外的文件,我现在正在require
顶部做一个.
...
require("./other_file")
...
Run Code Online (Sandbox Code Playgroud)
然后我gulpfile.js
看起来像这样:
function compile(watch) {
var bundler = watchify(browserify({
entries: ['./src/index.js'],
debug: true,
sourceType: module,
})
.transform(babelify));
function rebundle() {
bundler.bundle()
.on('error', function(err) { console.error(err); this.emit('end'); })
.pipe(source('build.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist'));
}
if (watch) {
bundler.on('update', function() {
console.log('-> bundling...');
rebundle();
});
}
rebundle();
}
Run Code Online (Sandbox Code Playgroud)
我不确定我是否应该使用concat
我需要的所有文件,然后浏览更大的concat
ted文件或只是browserify
主文件,它require
会起作用吗?
(我在这里遵循gulpfile示例)
归档时间: |
|
查看次数: |
2651 次 |
最近记录: |