Skip to content

Commit 5dff91d

Browse files
docs: simplify ESM init file in SDK instrumentation prompt (#211)
1 parent f7a55d8 commit 5dff91d

1 file changed

Lines changed: 1 addition & 20 deletions

File tree

internal/agent/prompts/phase_instrument_sdk.md

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ IMPORTANT: All code files must end with a trailing newline.
102102

103103
NOTE: This is LOCAL setup - do NOT use any API keys. Leave apiKey undefined for local mode.
104104

105-
**For CommonJS (module_system = "cjs"):**
105+
The init file is the same for both CommonJS and ESM projects. The SDK automatically registers ESM loader hooks when needed.
106106

107107
```typescript
108108
import { TuskDrift } from "@use-tusk/drift-node-sdk";
@@ -115,25 +115,6 @@ TuskDrift.initialize({
115115
export { TuskDrift };
116116
```
117117

118-
**For ESM (module_system = "esm"):**
119-
120-
```typescript
121-
import { register } from "node:module";
122-
import { pathToFileURL } from "node:url";
123-
124-
// Register the ESM loader - MUST be before importing the SDK
125-
register("@use-tusk/drift-node-sdk/hook.mjs", pathToFileURL("./"));
126-
127-
import { TuskDrift } from "@use-tusk/drift-node-sdk";
128-
129-
TuskDrift.initialize({
130-
env: process.env.NODE_ENV,
131-
logLevel: "debug",
132-
});
133-
134-
export { TuskDrift };
135-
```
136-
137118
#### Step 3: Import SDK at Entry Point
138119

139120
**For CommonJS:** Add as the FIRST import in the entry file:

0 commit comments

Comments
 (0)