From df5d01b94fef43e6ca8d2fab5219f90811700405 Mon Sep 17 00:00:00 2001 From: Kevin Fleischman Date: Fri, 19 Mar 2021 05:45:27 -0400 Subject: [PATCH] fix(utils): fix warning thrown by Webpack (#2843) Fixes a warning thrown by Webpack for using "require" without importing anything. Warning reads "require function is used in a way in which dependencies cannot be statically extracted" Closes issue #2840 --- lib/core/utils/uuid.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/core/utils/uuid.js b/lib/core/utils/uuid.js index b52b113c3d..c172988a48 100644 --- a/lib/core/utils/uuid.js +++ b/lib/core/utils/uuid.js @@ -24,10 +24,10 @@ if (!_rng && _crypto && _crypto.getRandomValues) { } try { - if (!_rng && require) { - const nodeCrypto = require('crypto'); - _rng = () => nodeCrypto.randomBytes(16); - } + if (!_rng) { + const nodeCrypto = require('crypto'); + _rng = () => nodeCrypto.randomBytes(16); + } } catch (e) { /* do nothing */ }