feature: add support for ES modules
See original GitHub issueTypeDI is incompatible with Node 13 and 14 when using ES6 Modules (e.g. in Node 14 you activate it with "type": "module" in your package.json).
I receive the following error:
api | import { Service } from 'typedi';
api | ^^^^^^^
api | SyntaxError: The requested module 'typedi' does not provide an export named 'Service'
api | at ModuleJob._instantiate (internal/modules/esm/module_job.js:92:21)
api | at async ModuleJob.run (internal/modules/esm/module_job.js:107:20)
api | at async Loader.import (internal/modules/esm/loader.js:179:24)
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Using ES modules in Node.js - LogRocket Blog
Modules are independent building blocks of a software program. They are basically a design pattern that implements features of modular ...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Node.js fully supports ECMAScript modules as they are currently specified and provides interoperability between them and its original module format, CommonJS.
Read more >ES modules: A cartoon deep-dive - Mozilla Hacks - the Web ...
ESM (EcmaScript modules) is a newer system which has been added to the JavaScript specification. Browsers already support ES modules, and Node ...
Read more >Announcing core Node.js support for ECMAScript modules
However, now that Node.js supports both CommonJS and ES modules, it is best to be ... An experimental feature, conditional exports, would add...
Read more >Using Node.js ES modules and top-level await in AWS Lambda
It provides customers the benefits of ES module features like import/export operators, language-level support for modules, strict mode by ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@desmap TypeGraphQL is not a part of the typestack. The only TypeGraphQL requirement for DI lib is the
.get()method of container, so it works with every other DI lib in Node.js. TypeDI is mentioned in docs/examples only because of it’s simplicity, like Apollo Server is even as it’s super slow TBH (https://github.com/benawad/node-graphql-benchmarks#benchmarks) 😉 For production apps I would use https://github.com/microsoft/tsyringe.This has been added in 45b0974a2a4d563811b43887a49433aed35f2aee. It will be released in the next version.