forked from wework/json-schema-to-openapi-schema
-
Notifications
You must be signed in to change notification settings - Fork 18
Closed
Description
With previous the version 2, I had no issue using this package with tsx or ts-node targeting esm.
Now with version 3, convert is not a function but an object with a default key containing the function.
Here is what I mean:
Convert2: [AsyncFunction: convert]
Convert3: { default: [AsyncFunction: convert] }
Below the steps to reproduce in Node v20.11.1.
Install:
npm init -y
npm i -D tsx ts-node
npm i json-schema-to-openapi-schema2@npm:@openapi-contrib/json-schema-to-openapi-schema@2 \
json-schema-to-openapi-schema3@npm:@openapi-contrib/json-schema-to-openapi-schema@3 \
package.json:
{
// ...
"type": "module",
// ...
}
test.ts:
import convert2 from 'json-schema-to-openapi-schema2';
import convert3 from 'json-schema-to-openapi-schema3';
console.log('Convert2:', convert2);
console.log('Convert3:', convert3);
tscong.json:
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"alwaysStrict": true
}
}
Run with tsx:
npx tsx ts-node/esm index.ts
Run with ts-node:
node --loader ts-node/esm index.ts
yehudiduhey, venoxam, dorianfouvez, Longwelwind, TheMoums and 2 more
Metadata
Metadata
Assignees
Labels
No labels