You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This behavior is also seen using the command line, but here is my Gulp file below:
When running on Windows the plugin works perfectly. The expected behavior is that upon save of any typescript file in the require tree of test-app.ts, the tsify plugin will compile the js files and then let browserify compile those files. On Mac OSX, this appears to not happen in the proper sequence, resulting in each change being one "save" behind.
For instance, if I add a console log of:
console.log("log 1");
The first time I save, it won't show up. If I change it to:
console.log("log 2");
I will then see "log 1" in the console. Upon next save, I'll then see "log 2".
'use strict';
var watchify = require('watchify');
var browserify = require('browserify');
var gulp = require('gulp');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var gutil = require('gulp-util');
var sourcemaps = require('gulp-sourcemaps');
var assign = require('lodash.assign');
// add custom browserify options here
var customOpts = {
entries: ['./test-app.ts'],
debug: true
};
var opts = assign({}, watchify.args, customOpts);
var b = watchify(browserify(opts));
gulp.task('js', bundle); // so you can run `gulp js` to build the file
b.on('update', bundle); // on any dep update, runs the bundler
b.on('log', gutil.log); // output build logs to terminal
b.plugin('tsify')
function bundle() {
return b.bundle()
// log errors if they happen
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('bundle.js'))
// optional, remove if you don't need to buffer file contents
.pipe(buffer())
// optional, remove if you dont want sourcemaps
.pipe(sourcemaps.init({loadMaps: true})) // loads map from browserify file
// Add transformation tasks to the pipeline here.
.pipe(sourcemaps.write('./')) // writes .map file
.pipe(gulp.dest('./'));
}
gulp.task("bundle", function () {
bundle();
})
The text was updated successfully, but these errors were encountered:
Just a thought, try moving b.plugin('tsify') above b.on('update', bundle). Maybe there's something platform-dependent with regards to how the event listeners get fired.
Also, what is this? A platform-specific issue where Windows isn't the problem?? 😱
Ok, that still doesn't work. I'm on Windows while my co-worker with the problem is on Mac. We tried moving that line all around and it still does the same behavior. I thought maybe it was that he had a separate file watcher in Atom Editor that was maybe fooling Browserify, but we disabled that and confirmed that while it's compiling the typescript correctly, it's compiling Browserify before tsify.
This behavior is also seen using the command line, but here is my Gulp file below:
When running on Windows the plugin works perfectly. The expected behavior is that upon save of any typescript file in the require tree of test-app.ts, the tsify plugin will compile the js files and then let browserify compile those files. On Mac OSX, this appears to not happen in the proper sequence, resulting in each change being one "save" behind.
For instance, if I add a console log of:
The first time I save, it won't show up. If I change it to:
I will then see "log 1" in the console. Upon next save, I'll then see "log 2".
The text was updated successfully, but these errors were encountered: