Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency number is undefined for relative includes when specifying many files #1266

Closed
ptarjan opened this issue May 15, 2015 · 5 comments · Fixed by #1268
Closed

Dependency number is undefined for relative includes when specifying many files #1266

ptarjan opened this issue May 15, 2015 · 5 comments · Fixed by #1268

Comments

@ptarjan
Copy link

ptarjan commented May 15, 2015

With this simple setup

$ cat a.js
var b = require('./b.js');
console.log(b.foo());
$ cat b.js
exports.foo = function() {
  return 'works';
};

Then with version 9.0.8 I happily get "./b.js":2

$ browserify --version
9.0.8
15:16:16 pt@Pauls-MBP:/tmp/browsesrify$ browserify a.js b.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var b = require('./b.js');
console.log(b.foo());

},{"./b.js":2}],2:[function(require,module,exports){
exports.foo = function() {
  return 'works';
};

},{}]},{},[1,2]);

But with 10.2.0

$ node_modules/browserify/bin/cmd.js --version
10.2.0
$ node_modules/browserify/bin/cmd.js a.js b.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
var b = require('./b.js');
console.log(b.foo());

},{"./b.js":undefined}],2:[function(require,module,exports){
exports.foo = function() {
  return 'works';
};

},{}]},{},[1,2]);

Note for just a single file it works:

$ node_modules/browserify/bin/cmd.js a.js
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
exports.foo = function() {
  return 'works';
};

},{}],2:[function(require,module,exports){
var b = require('./b.js');
console.log(b.foo());

},{"./b.js":1}]},{},[2]);
@zertosh
Copy link
Member

zertosh commented May 16, 2015

Sorry @ptarjan, I broke that in 10.1.1. Prior to that, your example would've worked via the CLI but not API - we're trying to sort those differences out. But #1268 fixes it, I'll get that merged soon.

@ptarjan
Copy link
Author

ptarjan commented May 17, 2015

Thanks for the quick fix.

@ptarjan
Copy link
Author

ptarjan commented Jun 2, 2015

I don't quite understand your process. Is this fixed in 10.2.3?

@zertosh
Copy link
Member

zertosh commented Jun 5, 2015

@ptarjan sorry this is being held up. I'll merge it tmw.

@zertosh
Copy link
Member

zertosh commented Jun 6, 2015

the fix was published in v10.2.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants