Skip to content

Conversation

@bnoordhuis
Copy link
Member

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

R=@silverwind?

CI: https://ci.nodejs.org/job/node-test-pull-request/969/

@bnoordhuisbnoordhuis added the repl Issues and PRs related to the REPL subsystem. label Dec 9, 2015
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tiny nit: while answer gets hoisted, It'd be more clear if you move this above the server.listen block.

@silverwind
Copy link
Contributor

LGTM.

The repl/node_modules lookup I mentioned earlier is already present in <5.2 so i'm fine with keeping it, whatever its purpose might be :)

@silverwind
Copy link
Contributor

@nodejs/release we should follow up with a quick patch release once this has landed, as the bug made the REPL pretty much unuseable.

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: nodejs#4208 PR-URL: nodejs#4215 Reviewed-By: Roman Reiss <[email protected]>
@bnoordhuisbnoordhuis deleted the fix4208 branch December 9, 2015 22:31
@bnoordhuisbnoordhuis merged commit 213ede6 into nodejs:masterDec 9, 2015
@bnoordhuis
Copy link
MemberAuthor

Landed with the suggested style fix-up in 213ede6. Thanks for the review, @silverwind.

bnoordhuis added a commit that referenced this pull request Dec 15, 2015
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 <[email protected]>
cjihrig added a commit that referenced this pull request Dec 15, 2015
Notable changes: * domains: - Fix handling of uncaught exceptions. (Julien Gilli) #3654. * https: - Added support for disabling session caching. (Fedor Indutny) #4252. * repl: - Allow third party modules to be imported using require(). This corrects a regression from 5.2.0. (Ben Noordhuis) #4215. * deps: - Upgrade libuv to 1.8.0. (Saúl Ibarra Corretgé) #4276. PR-URL: #4281
cjihrig added a commit that referenced this pull request Dec 16, 2015
Notable changes: * buffer: - Buffer.prototype.includes() has been added to keep parity with TypedArrays. (Alexander Martin) #3567. * domains: - Fix handling of uncaught exceptions. (Julien Gilli) #3654. * https: - Added support for disabling session caching. (Fedor Indutny) #4252. * repl: - Allow third party modules to be imported using require(). This corrects a regression from 5.2.0. (Ben Noordhuis) #4215. * deps: - Upgrade libuv to 1.8.0. (Saúl Ibarra Corretgé) #4276. PR-URL: #4281
cjihrig added a commit that referenced this pull request Dec 16, 2015
Notable changes: * buffer: - Buffer.prototype.includes() has been added to keep parity with TypedArrays. (Alexander Martin) #3567. * domains: - Fix handling of uncaught exceptions. (Julien Gilli) #3654. * https: - Added support for disabling session caching. (Fedor Indutny) #4252. * repl: - Allow third party modules to be imported using require(). This corrects a regression from 5.2.0. (Ben Noordhuis) #4215. * deps: - Upgrade libuv to 1.8.0. (Saúl Ibarra Corretgé) #4276. PR-URL: #4281 Conflicts: src/node_version.h
@ljharbljharb mentioned this pull request Dec 16, 2015
@rvaggrvagg mentioned this pull request Dec 17, 2015
cjihrig pushed a commit to cjihrig/node that referenced this pull request Jan 7, 2016
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: nodejs#4208 PR-URL: nodejs#4215 Reviewed-By: Roman Reiss <[email protected]>
@MylesBorins
Copy link
Contributor

@Fishrock123 I'm removing the land-on-v5.x label as it landed in v5.3.0

@Fishrock123
Copy link
Contributor

@thealphanerd I don't really pay attention to that anyways. The dont-land-on label(s) are much better for Stable branches since we basically just land everything that applies and isn't breaking and doesn't have that label.

MylesBorins pushed a commit that referenced this pull request Jan 19, 2016
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 <[email protected]>
@MylesBorinsMylesBorins mentioned this pull request Jan 19, 2016
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
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: nodejs#4208 PR-URL: nodejs#4215 Reviewed-By: Roman Reiss <[email protected]>
scovetta pushed a commit to scovetta/node that referenced this pull request Apr 2, 2016
Notable changes: * buffer: - Buffer.prototype.includes() has been added to keep parity with TypedArrays. (Alexander Martin) nodejs#3567. * domains: - Fix handling of uncaught exceptions. (Julien Gilli) nodejs#3654. * https: - Added support for disabling session caching. (Fedor Indutny) nodejs#4252. * repl: - Allow third party modules to be imported using require(). This corrects a regression from 5.2.0. (Ben Noordhuis) nodejs#4215. * deps: - Upgrade libuv to 1.8.0. (Saúl Ibarra Corretgé) nodejs#4276. PR-URL: nodejs#4281 Conflicts: src/node_version.h
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

replIssues and PRs related to the REPL subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@bnoordhuis@silverwind@MylesBorins@Fishrock123