Open
Description
Description of the bug:
While trying to use the new gemini SDK in my nestJS server I get this error:
err:
require() of ES Module path-toproject\dist\gemini\gemini.service.js not supported.
index.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead either rename index.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in node_modules\.pnpm\@[email protected]_@[email protected]\node_modules\@google\genai\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
I've tried updating my config and using dynamic imports, but it doesn't seem to work. Can this be addressed?
Actual vs expected behavior:
Server is unable to start
Any other information you'd like to share?
Note:
Server is unable to start to import the bundle properly, can be fixed by changing tsconfig props but that is incompatible with NestJS configurations
Metadata
Metadata
Assignees
Labels
No labels