AHGGG / poe-node-api

A reverse engineered Node.js client for Quora's Poe.
MIT License
38 stars 5 forks source link

Not working with Typescript #15

Closed mustafa-barakat closed 1 year ago

mustafa-barakat commented 1 year ago

I'm using NestJS with the module, using npm install poe-node-api

import { PoeClient } from 'poe-node-api';
 const client = new PoeClient({ logLevel: 'debug' });

Getting Error

Error [ERR_REQUIRE_ESM]: require() of ES Module PROJECTFOLDER\node_modules\poe-node-api\dist\PoeClient.js from PROJECTFOLDER\dist\s1\s1.service.js not supported.
Instead change the require of PoeClient.js in PROJECTFOLDER\dist\s1\s1.service.js to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (PROJECTFOLDER\dist\s1\s1.service.js:14:21)
    at Object.<anonymous> (PROJECTFOLDER\dist\s2\s2.service.js:16:21)
    at Object.<anonymous> (PROJECTFOLDER\dist\s2\s2.module.js:12:22)
    at Object.<anonymous> (PROJECTFOLDER\dist\app.module.js:16:21)
    at Object.<anonymous> (PROJECTFOLDER\dist\main.js:6:20)

Any idea why ?

AHGGG commented 1 year ago

https://codingbeautydev.com/blog/require-of-es-modules-is-not-supported/

AHGGG commented 1 year ago

Is this issue still active?