Gilad S 3a694dd3e9
feat: ESM support (#8536)
* feat: support importing TypeORM in esm projects

Closes: #6974
Closes: #6941

* bugfix: generate index.mjs directly out of commonjs exports

The new implementation generates ESM exports directly out of the commonjs exports, and provides a default export to maintain compatability with existing `import`s of the commonjs implementation

* feat: support loading ESM entity and connection config files

When TypeORM tries to load an entity file or a connection config file, it will determine what is the appropriate module system to use for the file and then `import` or `require` it as it sees fit.

Closes: #7516
Closes: #7159

* fix: adapt ImportUtils.importOrRequireFile tests to older version of nodejs

* fix: improved importOrRequireFile implementation

* feat: add solution to circular dependency issue in ESM projects

* docs: added FAQ regarding ESM projects

* chore: add `"type": "commonjs"` to package.json

* style

* docs: improve `ts-node` usage examples for CLI commands in ESM projects

* feat: add support for generating an ESM base project

* refactor: renamed `Related` type to `Relation`

* docs: added a section in the Getting Started guide regarding the `Relation` wrapper type in ESM projects

* docs: improved documentation of the `Relation` type

* docs: improved documentation of the `Relation` type

* docs: added ESM support to the list of TypeORM features
2022-01-31 14:25:58 +05:00
..
2019-01-18 14:42:20 +08:00
2019-01-18 14:42:20 +08:00
2019-01-18 14:42:20 +08:00
2022-01-31 14:25:58 +05:00
2021-01-11 18:00:53 +05:00
2019-03-09 18:30:38 +05:00
2019-01-18 14:42:20 +08:00
2022-01-31 14:25:58 +05:00
2019-01-18 14:42:20 +08:00
2019-01-18 14:42:20 +08:00
2022-01-31 14:25:58 +05:00
2019-01-18 14:42:20 +08:00
2019-01-18 14:42:20 +08:00
2019-01-18 14:42:20 +08:00