Closed kutny closed 1 year ago
This is an issue related with Ts and NodeJs . Not with ndi itself. seems like your are not using import but require or something like this.
this looks like NDI uses require in FileLoader https://github.com/zazoomauro/node-dependency-injection/blob/cf7b236d440cc2d5a79a6b40798ecc211a770c11/lib/Loader/FileLoader.js#L284 which is not compatible with ESM so looks like no support for ESM as it should use import instead (import is async in ESM so it probably require some major efforts to make NDI ESM compatible)
as an alternative, you might try to use some tooling as esbuild to support cjs in your esm project or import NDI with dynamic import in your esm project (await import('node-dependency-injection')
)
hope this helps someone
Hi, I'm kind of a typescript beginner also coming from the PHP/Symfony world.
Got the following error:
I have
"type": "module"
set in package.jsonMy tsconfig.json
services.yaml
Typescript: 5.0.3
running a .ts script using
nodemon --experimental-specifier-resolution=node ./src/index.ts
Thanks for your help