maxlath / wikibase-sdk

JS utils functions to query a Wikibase instance and simplify its results
MIT License
325 stars 47 forks source link

No "export" main defined in package.json #124

Open AlexW00 opened 1 year ago

AlexW00 commented 1 year ago
  1. Install wikibase-sdk via npm i wikibase-sdk
  2. Try to run your code
  3. Get error:
Error: No "exports" main defined in /home/aw/Developer/Work/graph-it/graphit-app/api/node_modules/wikibase-sdk/package.json
    at new NodeError (node:internal/errors:387:5)
    at throwExportsNotFound (node:internal/modules/esm/resolve:439:9)
    at packageExportsResolve (node:internal/modules/esm/resolve:663:7)
    at resolveExports (node:internal/modules/cjs/loader:493:36)
    at Function.Module._findPath (node:internal/modules/cjs/loader:533:31)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:942:27)
    at Function.Module._resolveFilename (/home/aw/Developer/Work/graph-it/graphit-app/node_modules/tsconfig-paths/src/register.ts:115:36)
    at Function.Module._load (node:internal/modules/cjs/loader:804:27)
    at Module.require (node:internal/modules/cjs/loader:1022:19)
    at require (node:internal/modules/cjs/helpers:102:18)
[ERROR] 20:33:14 Error: No "exports" main defined in /home/aw/Developer/Work/graph-it/graphit-app/api/node_modules/wikibase-sdk/package.json
Child got SIGTERM, exiting.

My tsconfig:

{
    "compilerOptions": {
        "baseUrl": ".",
        "sourceRoot": "src",
        "module": "commonjs",
        "target": "esnext",
        "sourceMap": true,
        "declaration": false,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "moduleResolution": "node",
        "isolatedModules": false,
        "suppressImplicitAnyIndexErrors": false,
        "noImplicitAny": false,
        "strictNullChecks": true,
        "noUnusedLocals": false,
        "noUnusedParameters": false,
        "allowSyntheticDefaultImports": true,
        "importHelpers": true,
        "newLine": "LF",
        "noEmit": true,
        "esModuleInterop": true,
        "resolveJsonModule": true,
        "lib": ["es7", "dom", "ESNext.AsyncIterable"],
        "typeRoots": ["../node_modules/@types"],
    },
    "include": ["src"],
    "linterOptions": {
        "exclude": []
    }
}
AlexW00 commented 1 year ago

monorepo issue

AlexW00 commented 1 year ago

Actually it's not. V8 works, but v9 does not.

EdJoPaTo commented 1 year ago

v9 requires ES Modules and can not be used from CommonJS anymore