-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Surprising require('./file') behavior when ran from REPL #30808
Labels
Comments
addaleax
changed the title
Surprising require('./file') behavior when ran from cli
Surprising require('./file') behavior when ran from REPL
Dec 5, 2019
@eridal I would consider this a bug as well. (I’ve modified the title since “cli” would more typically refer to @nodejs/repl |
I think #30835 is able to fix this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Where?
Repo Steps
Given the following tree:
The following code will produce different behavior when executed as a main module, required module, or from the REPL
Tests
1. As main module:
2. As stdin input:
3. As REPL commands:
This is the surprising behavior
4. As REPL but indirectly loaded
Is this a bug?
I'm not sure if this is a bug or not, but it is quite surprising to me.
I'd expect
require
to behave the same no matter from where it is being executed. Why is that the REPL behaves differently?The text was updated successfully, but these errors were encountered: