hatchet-dev / hatchet-typescript

Hatchet Typescript SDK for Interacting with the Hatchet Engine
8 stars 2 forks source link

Critical Dependency Warning #200

Open mcrovero opened 1 week ago

mcrovero commented 1 week ago

When using next version 14.2.4 and @hatchet-dev/typescript-sdk version ^0.10.0, the console is flooded with a critical dependency warning:

Critical dependency: the request of a dependency is an expression

Environment:

OS: [e.g., macOS 12.6] Node.js version: 19.3.0 Next.js version: 14.2.4 @hatchet-dev/typescript-sdk version: 0.10.0 Additional context The warning traces back to the following import paths:

../../node_modules/.pnpm/@hatchet-dev+typescript-sdk@0.10.0/node_modules/@hatchet-dev/typescript-sdk/util/thread-helper.js
../../node_modules/.pnpm/@hatchet-dev+typescript-sdk@0.10.0/node_modules/@hatchet-dev/typescript-sdk/clients/dispatcher/heartbeat/heartbeat-controller.js
../../node_modules/.pnpm/@hatchet-dev+typescript-sdk@0.10.0/node_modules/@hatchet-dev/typescript-sdk/clients/dispatcher/action-listener.js
../../node_modules/.pnpm/@hatchet-dev+typescript-sdk@0.10.0/node_modules/@hatchet-dev/typescript-sdk/clients/dispatcher/dispatcher-client.js
../../node_modules/.pnpm/@hatchet-dev+typescript-sdk@0.10.0/node_modules/@hatchet-dev/typescript-sdk/clients/hatchet-client/hatchet-client.js
../../node_modules/.pnpm/@hatchet-dev+typescript-sdk@0.10.0/node_modules/@hatchet-dev/typescript-sdk/index.js
./services/hatchet-client.ts
./app/api/import/route.ts

While the error is just a warning, it significantly clutters the console output, making it harder to debug other issues.

Don't know if it may help but using turbopack the error crashes the app.

abelanger5 commented 1 week ago

Hey @mcrovero, we'll look into this. What is exported out of ./services/hatchet-client.ts?

mcrovero commented 1 week ago
import Hatchet from "@hatchet-dev/typescript-sdk";

let hatchetClient: Hatchet | undefined;
export const getHatchetClient = () => {
  if (!hatchetClient) {
    hatchetClient = Hatchet.init();
  }
  return hatchetClient;
};

This is the entire file.

I investigated further and It is linked to the tsconfig configuration. I had inside compilerOptions: "declarationMap": false, "declaration": false

by removing these lines it disappears while running in dev.

No still happens