File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ IMPORTANT: All code files must end with a trailing newline.
102102
103103NOTE: 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
108108import { TuskDrift } from " @use-tusk/drift-node-sdk" ;
@@ -115,25 +115,6 @@ TuskDrift.initialize({
115115export { 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:
You can’t perform that action at this time.
0 commit comments