Skip to content

Commit 1643fe2

Browse files
committed
Augment binary module search to aid Webpack use
1 parent 45fc5e8 commit 1643fe2

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
- Fixed various execution failures with Node.js 13.2 due to Node.js NULL pointer behavior change ([ODPI-C
2323
change](https://github.com/oracle/odpi/commit/7693865bb6a98568546aa319cc0fdb9e208cf9d4)).
2424

25+
- Added a directory the binary module search to help Webpack use, though a copy
26+
plugin is still required, see
27+
[here](https://github.com/oracle/node-oracledb/issues/1156#issuecomment-571554125).
28+
2529
- Fixed some static code analysis warnings.
2630

2731
## node-oracledb v4.1.0 (26 Nov 2019)

lib/oracledb.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved
1+
// Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved
22

33
//-----------------------------------------------------------------------------
44
//
@@ -59,7 +59,10 @@ const defaultPoolAlias = 'default';
5959
const binaryLocations = [
6060
'../' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE, // pre-built binary
6161
'../' + nodbUtil.RELEASE_DIR + '/' + 'oracledb.node', // binary built from source
62-
'../build/Debug/oracledb.node' // debug binary
62+
'../build/Debug/oracledb.node', // debug binary
63+
// Ease Webpack use, see https://github.com/oracle/node-oracledb/issues/1156
64+
'./node_modules/oracledb/' + nodbUtil.RELEASE_DIR + '/' + nodbUtil.BINARY_FILE,
65+
'./node_modules/oracledb/' + nodbUtil.RELEASE_DIR + '/' + 'oracledb.node'
6366
];
6467

6568
let oracledbCLib;
@@ -71,7 +74,7 @@ for (let i = 0; i < binaryLocations.length; i++) {
7174
if (err.code !== 'MODULE_NOT_FOUND' || i == binaryLocations.length - 1) {
7275
let nodeInfo;
7376
if (err.code === 'MODULE_NOT_FOUND') {
74-
// none of the three binaries could be found
77+
// a binary was not found in any of the search directories
7578
nodeInfo = `\n Looked for ${binaryLocations.map(x => require('path').resolve(__dirname, x)).join(', ')}\n ${nodbUtil.getInstallURL()}\n`;
7679
} else {
7780
nodeInfo = `\n Node.js require('oracledb') error was:\n ${err.message}\n ${nodbUtil.getInstallHelp()}\n`;

0 commit comments

Comments
 (0)