Skip to content
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

fix(utils): fix warning thrown by Webpack #2843

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/core/utils/uuid.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (!_rng && _crypto && _crypto.getRandomValues) {
}

try {
if (!_rng && require) {
if (!_rng) {
Copy link
Member

Choose a reason for hiding this comment

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

This change worries me. How does this change effect other supported environments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Before, if require wasn't defined, it would skip the conditional and continue on. Now, if require isn't defined, an error will be thrown by require('crypto') on the next line, which will be caught by the try/catch block. I don't think this changes the execution in a meaningful way

Copy link
Member

Choose a reason for hiding this comment

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

Thanks for the explanation.

const nodeCrypto = require('crypto');
_rng = () => nodeCrypto.randomBytes(16);
}
Expand Down