Skip to content

Commit 668ccb3

Browse files
committed
Remove the 'Critical Dependency' warning from webpack builds (Issue #1678
1 parent e64ce4a commit 668ccb3

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

doc/src/release_notes.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ Common Changes
4242
#) Added method :meth:`oracledb.getNetworkServiceNames()` to support fetching
4343
the list of network service names from the ``tnsnames.ora`` file.
4444

45+
#) Remove the 'Critical Dependency' warning from webpack builds.
46+
See `Issue #1678 <https://github.com/oracle/node-oracledb/issues/1678>`__.
47+
4548
Thin Mode Changes
4649
+++++++++++++++++
4750

lib/oracledb.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,16 @@ let _initOracleClientArgs;
7474

7575
// Load the Oracledb binary
7676
function _initCLib(options) {
77+
// Ensure that webpack compile does not throw any issues or warnings
78+
// See https://github.com/oracle/node-oracledb/issues/1156
79+
// and https://github.com/oracle/node-oracledb/issues/1678
80+
const nodeVer = typeof process !== 'undefined' && process.versions?.node;
7781
/*global __non_webpack_require__*/ // quieten eslint
78-
const requireBinary = (typeof __non_webpack_require__ === 'function') ? __non_webpack_require__ : require; // See Issue 1156
82+
const requireBinary = nodeVer
83+
? (typeof __webpack_require__ === 'function')
84+
? __non_webpack_require__
85+
: require
86+
: undefined;
7987
const binaryLocations = [
8088
'../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE, // pre-built binary
8189
'../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BUILD_FILE, // binary built from source

0 commit comments

Comments
 (0)