Skip to content

Conversation

@aleclarson
Copy link

Since I have symlinks in the node_modules of many of my local packages,
I have altered Module._load to support symlink resolution.
This effectively cleans up stack traces when using symlink'd depedencies.

For paths that are neither absolute nor relative:

  • require('my-module')Module._load('my-module', parent, isMain)
  • find the package.json nearest to parent.id
  • check for symbolic link at path.dirname("path/to/package.json") + "/node_modules"

This PR also includes support for relative imports via the console.

// When entered in the console, it's assumed you mean "relative to process.cwd()".
require('./my-module')

@aleclarson aleclarson force-pushed the resolve-symlinks branch 2 times, most recently from 1cbba0c to bc24f57 Compare September 15, 2016 17:25
@aleclarson
Copy link
Author

After my patches, this all works as intended. LMK what you think. 😁

@aleclarson aleclarson closed this May 27, 2018
@aleclarson aleclarson deleted the resolve-symlinks branch May 27, 2018 22:21
@aleclarson
Copy link
Author

aleclarson commented May 27, 2018

#126 provides the "relative imports from console" fix

The symlink-related code is no longer useful. At least with [email protected], which is all I tested.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant