Commit 41882e4
repl: fix require('3rdparty') regression
Fix module loading of third-party modules in the REPL by inheriting
module.paths from the REPL's parent module.
Commit ee72ee7 ("module,repl: remove repl require() hack") introduced
a regression where require() of modules in node_modules directories
no longer worked in the REPL (and fortunately only in the REPL.)
It turns out we didn't have test coverage for that but we do now.
Fixes: #4208
PR-URL: #4215
Reviewed-By: Roman Reiss <me@silverwind.io>1 parent 3080bdc commit 41882e4Copy full SHA for 41882e4
File tree
Expand file treeCollapse file tree
3 files changed
+38
-0
lines changedOpen diff view settings
Filter options
- lib
- test
- fixtures/node_modules/baz
- parallel
Expand file treeCollapse file tree
3 files changed
+38
-0
lines changedOpen diff view settings
Collapse file
+3Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
35 | 35 | |
36 | 36 | |
37 | 37 | |
| 38 | + |
38 | 39 | |
39 | 40 | |
40 | 41 | |
| ||
512 | 513 | |
513 | 514 | |
514 | 515 | |
| 516 | + |
| 517 | + |
515 | 518 | |
516 | 519 | |
517 | 520 | |
|
Collapse file
test/fixtures/node_modules/baz/index.js
Copy file name to clipboardExpand all lines: test/fixtures/node_modules/baz/index.js+2Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file
test/parallel/test-repl-require.js
Copy file name to clipboard+33Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
| 1 | + |
| 2 | + |
| 3 | + |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | + |
0 commit comments