1

We are using Gulp with browserify, and I am having a problem diagnosing an error. Browserify runs, reporting no problems, however, many of the scripts that should have been concatenated into my output js file are missing.

We have found that this can happen if we are missing an npm package (if we need to run npm install), or if there is something wrong with an npm package. The past couple of times it has happened, we have been lucky in that we had only just added 1 package and so we immediately knew where to look.

Now, I have it failing on a dev machine (by fail, I mean that my output .js file is 1/10th the size it should be an missing many js files, but no errors reported). I am not sure which package it is failing on, and I am getting no diagnostics.

I tried hooking .on('error') as described here: https://stackoverflow.com/a/24817446/67038, but there was no additional output.

The output from the Visual Studio Task Runner Explorer looks like this:

[18:17:21] Using gulpfile C:\git\...\Gulpfile.js
[18:17:21] Starting 'browserify:local'...
[18:17:24] Finished 'browserify:local' after 2.63 s
[18:17:24] Starting 'build:local'...
[18:17:24] Finished 'build:local' after 31 ms
Process terminated with code 0.

What can I do to get additional information from Browserify? Is there some sort of logging that I can turn on?

Community
  • 1
  • 1
JMarsch
  • 21,484
  • 15
  • 77
  • 125
  • There is a [`fullPaths`](https://github.com/substack/node-browserify#browserifyfiles--opts) option that you might find useful. Setting it to `true` will see full module paths written into the bundle instead of indices. – cartant Aug 22 '16 at 23:54
  • Are you using any transforms or plugins? – cartant Aug 23 '16 at 00:05
  • @cartant We are using tsify (we author in typescript), and we pipe (via vinyl) to sourcemaps (we are using browserify "proper", not the gulp browserify plugin). – JMarsch Aug 23 '16 at 13:51
  • I had a feeling you might be using `tsify` - I am one of its maintainers. Your issue touches on something that has caused problems for me in the past and on something I'd like to change. Could you please [create an issue for it](https://github.com/TypeStrong/tsify) so that we can continue this conversation in the GitHub repo? I will come back to SO and post an answer once we get it sorted. – cartant Aug 23 '16 at 22:06
  • I think timezone issues are getting in the way of resolving this. I've created an [issue](https://github.com/TypeStrong/tsify/issues/187). If you can comment on the issue, I'll get emailed and we can get this sorted. – cartant Aug 24 '16 at 01:24
  • Will do -- sorry, I had intended to create an issue yesterday, and got sidetracked. – JMarsch Aug 24 '16 at 13:42

1 Answers1

1

The problem you experienced was caused by the tsify plugin.

Prior to version 1.0.4, there were a number of path-related bugs that could result in empty modules being emitted without any errors being reported to Browserify. These bugs have been fixed and errors are now emitted to Browserify in situations that would have previously resulted in an empty module.

cartant
  • 57,105
  • 17
  • 163
  • 197