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

Browserify --list fails to use NODE_PATH #726

Closed
cymen opened this issue Apr 11, 2014 · 2 comments
Closed

Browserify --list fails to use NODE_PATH #726

cymen opened this issue Apr 11, 2014 · 2 comments

Comments

@cymen
Copy link
Contributor

cymen commented Apr 11, 2014

Given directory structure:

$ tree
.
├── assets
│   └── a.js
└── specs
    └── a_spec.js

a.js:

module.exports = 'a';

a_spec.js:

var a = require('a');

console.log('a is "a": ', a === 'a');

I can use NODE_PATH so that require('a') works:

$ NODE_PATH=/tmp/browserify-list-issue/assets node specs/a_spec.js
a is "a":  true

I can browserify a_spec.js using NODE_PATH:

$ NODE_PATH=/tmp/browserify-list-issue/assets browserify specs/a_spec.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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.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 a = require('a');

console.log('a is "a": ', a === 'a');

},{"a":2}],2:[function(require,module,exports){
module.exports = 'a';

},{}]},{},[1])

I cannot use browserify --list with NODE_PATH:

$ NODE_PATH=/tmp/browserify-list-issue/assets browserify --list specs/a_spec.js

stream.js:94
      throw er; // Unhandled stream error in pipe.
            ^
Error: Cannot find module 'a' from '/private/tmp/browserify-list-issue/specs'
    at /usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:44:17
    at process (/usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:110:43)
    at /usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:119:21
    at load (/usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:54:43)
    at /usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:22
    at /usr/local/share/npm/lib/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:16:47
    at Object.oncomplete (fs.js:107:15)

Git repo: https://github.com/cymen/browserify-list-issue

@cymen cymen changed the title Browserify --list fails to use NODE_PATH when module path not relative to current directory Browserify --list fails to use NODE_PATH Apr 11, 2014
@cymen
Copy link
Contributor Author

cymen commented Apr 11, 2014

I am using browserify 3.36.1 due to #725

@cymen
Copy link
Contributor Author

cymen commented Apr 11, 2014

This is resolved by browserify/module-deps#34

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant