| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 8bec8aa commit 0ae5d02
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -30,6 +30,16 @@ console.log(__dirname); | |||
| 30 | 30 | ||
| 31 | 31 | `__dirname` isn't actually a global but rather local to each module. | |
| 32 | 32 | ||
| 33 | + For instance, given two modules: `a` and `b`, where `b` is a dependency of | ||
| 34 | + `a` and there is a directory structure of: | ||
| 35 | + | ||
| 36 | + * `/Users/mjr/app/a.js` | ||
| 37 | + * `/Users/mjr/app/node_modules/b/b.js` | ||
| 38 | + | ||
| 39 | + References to `__dirname` within `b.js` will return | ||
| 40 | + `/Users/mjr/app/node_modules/b` while references to `__dirname` within `a.js` | ||
| 41 | + will return `/Users/mj/app`. | ||
| 42 | + | ||
| 33 | 43 | ## \_\_filename | |
| 34 | 44 | ||
| 35 | 45 | <!-- type=var --> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments