Last active
August 29, 2015 14:04
-
-
Save dandean/6e444c586dbae2a89c9e to your computer and use it in GitHub Desktop.
Link a module to itself to get around relative require hell.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add a link to itself in its own node_modules directory: | |
npm link && npm link app-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"private": "true", | |
"name": "app-name", | |
"version": "1.0.0" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// So something like this: | |
require('../../../lib/foo.js'); | |
// Is now: | |
require('app-name/lib/foo.js'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment