Closed mikhailshilkov closed 3 months ago
I've setup a basic TypeScript project using 3.0.0-beta.20 but it fails to compile with
3.0.0-beta.20
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'graphql' imported from /Users/mikhailshilkov/go/src/github.com/pulumi/play/weaviate/node_modules/graphql-request/build/esm/resolveRequestDocument.js
Adding an explicit reference to graphql fixes the problem.
graphql
My package.json:
package.json
{ "name": "weaviate-ts-example", "version": "1.0.0", "description": "", "main": "dist/index.js", "types": "dist/index.d.ts", "type": "module", "dependencies": { "weaviate-client": "^3.0.0-beta.20" }, "scripts": { "start": "tsc && node dist/index.js" }, "author": "", "license": "ISC", "devDependencies": { "typescript": "^4.9.5" } }
My tsconfig.json:
tsconfig.json
{ "compilerOptions": { "target": "es2020", "strict": true, "preserveConstEnums": true, "noEmit": false, "sourceMap": false, "module":"ES2022", "moduleResolution":"node", "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "isolatedModules": true, "outDir": "./dist" }, "include": ["**/*"], "exclude": ["node_modules"] }
My index.ts:
index.ts
import weaviate, { WeaviateClient } from 'weaviate-client'; const client: WeaviateClient = await weaviate.connectToWCS( 'redacted', { authCredentials: new weaviate.ApiKey('redacted'), } ); const response = await client.isReady(); console.log(response);
I'm using yarn.
Hi Mikhail, you're quite right that this dependency is missing, thanks for calling it out!
I'll make sure that it is fixed in the next beta release 😁
Have released v3.0.0-beta.21 with this fix!
v3.0.0-beta.21
I've setup a basic TypeScript project using
3.0.0-beta.20
but it fails to compile withAdding an explicit reference to
graphql
fixes the problem.My
package.json
:My
tsconfig.json
:My
index.ts
:I'm using yarn.