-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Doesn't work with babel #501
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
Comments
For the non-Babel readers (like me), can you give some more context, some setup hints, and working & non working testcases? |
Here's a minimal setup to reproduce the error: First install babel-cli:
Save the following as test.js:
Run the file with The output:
This ES6 code can be compiled to ES5 with babel. A working test case simply uses ES5 modules:
|
@panuhorsmalahti After looking into this a little, I think it has to do with the way that import in Babel differs from We should be able to put together a solution. In the meantime, please use |
@dmcghan are you tracking this? |
@cjbj Yes, I have a note to look into the with the next round of enhancements. |
@dmcghan ping |
@panuhorsmalahti Could you please try changing this line: import * as OracleDB from "oracledb"; to this: import OracleDB from "oracledb"; That's shorthand for this: import {default as OracleDB} from "oracledb"; Either one should work. It's a way of telling Babel to import the default export. When using the asterisk as you were doing before, Babel used _interopRequireWildcard instead of _interopRequireDefault. It seems that _interopRequireWildcard enumerates the properties of the export to create a new object. Not all properties are enumerable which lead to the error you saw. |
@panuhorsmalahti ping? |
The |
@panuhorsmalahti thanks for the feedback. |
Uh oh!
There was an error while loading. Please reload this page.
node-oracledb doesn't work when compiling ES6 modules with Babel. I'm using TypeScript + Babel, but I don't believe the use of TypeScript is relevant in this bug.
The following ES6 code doesn't work:
If I don't use
_interopRequireWildcard
the function works.Doesn't work (compiled ES5 JavaScript):
The following works:
Answer the following questions:
The error originates from this line:
https://github.com/oracle/node-oracledb/blob/master/lib/util.js#L96
None
6.4.0
instantclient 12.1.0.2.0
Mac OS X 10.11.6
Latest XCode
The text was updated successfully, but these errors were encountered: