Closed mouro001 closed 6 months ago
The same problem!
this package is esm, you'll have to use esm too or something like bun or the tsx
package that will bundle it for you. setup esm in typescript
see section I'm having problems with ESM and TypeScript https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#im-having-problems-with-esm-and-typescript
When using this package in typescript I get the following error:
System Information: Windows 11, NodeJS 20.12.2 (installed by nvm), Typescript 5.4.5 (installed by ts-node 10.9.2)
Example
index.ts: ```typescript import { QBittorrent } from '@ctrl/qbittorrent'; const client = new QBittorrent({ baseUrl: 'http://localhost:8080/', username: 'admin', password: 'adminadmin', }); async function main() { const res = await client.getAllData(); console.log(res); } main(); ``` package.json: ```json { "name": "qbittest", "version": "1.0.0", "description": "", "main": "index.ts", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "keywords": [], "author": "", "license": "ISC", "dependencies": { "@ctrl/qbittorrent": "^8.0.0" } } ``` tsconfig.json ```json { "compilerOptions": { "target": "ESNext", "module": "CommonJS", "rootDir": ".", "outDir": "./dist/", "strict": true, "moduleResolution": "Node", "experimentalDecorators": true, "esModuleInterop": true, "skipLibCheck": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "forceConsistentCasingInFileNames": true, "removeComments": true, "typeRoots": ["node_modules/@types"], "sourceMap": false, "baseUrl": "./", }, "files": ["index.ts"], "include": ["./**/*.ts"], "exclude": ["node_modules", "dist"] } ```