You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside the packge.json I add the library to the dependencies:
"dependencies": {
"ojp-sdk": "0.12.5"
}
Inside my code, I import the library (and needed jsdom) as follows:
import * as OJP from 'ojp-sdk';
import jsdom from 'jsdom';
const { JSDOM } = jsdom;
global.DOMParser = new JSDOM().window.DOMParser;
However when compiling, I get the following error message:
yarn run v1.22.19
warning ../../../../../package.json: No license field
$ nest start
/Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/stops/stops.service.js:47
const OJP = __importStar(require("ojp-sdk"));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/node_modules/ojp-sdk/lib/index.js from /Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/stops/stops.service.js not supported.
Instead change the require of index.js in /Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/stops/stops.service.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/stops/stops.service.js:47:26)
at Object.<anonymous> (/Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/teddies/teddies.controller.js:42:25)
at Object.<anonymous> (/Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/teddies/teddies.module.js:11:30)
at Object.<anonymous> (/Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/app.module.js:19:26)
at Object.<anonymous> (/Users/stephankorner/Documents/Dokumente_KOS/Programieren/NodeJS_private/teddy-api/dist/main.js:40:22) {
code: 'ERR_REQUIRE_ESM'
}
Node.js v18.18.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
My tsconfig.json File looks as follows.
Please note that I cannot change CommonJS or ES6 due to other libraries in my project !
Inside the
packge.json
I add the library to the dependencies:Inside my code, I import the library (and needed jsdom) as follows:
However when compiling, I get the following error message:
My
tsconfig.json
File looks as follows.Please note that I cannot change
CommonJS
orES6
due to other libraries in my project !Is there any way to update the
ojp-sdk
library so that it can work with the config inside my package.json ?The text was updated successfully, but these errors were encountered: