Skip to content

Node FS: Guard on require() existing before requiring. See #17851 #17917

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

Merged
merged 1 commit into from
Sep 23, 2022

Conversation

kripken
Copy link
Member

@kripken kripken commented Sep 22, 2022

No description provided.

@kripken kripken merged commit d315559 into main Sep 23, 2022
@kripken kripken deleted the guard.require branch September 23, 2022 00:50
var fs, nodePath;
if (typeof require === 'function') {
fs = require('fs');
nodePath = require('path');
Copy link
Collaborator

@sbc100 sbc100 Sep 23, 2022

Choose a reason for hiding this comment

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

Does having the var inside the condition not work?

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe it does work. Do we have a style preference?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants