MichalLytek / type-graphql

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
https://typegraphql.com
MIT License
7.98k stars 674 forks source link

registerEnumType not found in ES module (2.0.0-beta.4) #1602

Closed lbevilacqua closed 6 months ago

lbevilacqua commented 6 months ago

Describe the Bug

When running type-graphql in an ES module, node throws the following error

SyntaxError: The requested module 'type-graphql' does not provide an export named 'registerEnumType'

To Reproduce

Create a sample app with this package.json

{
  "name": "sample",
  "version": "0.0.1",
  "main": "index.js",
  "type": "module",
  "dependencies": {
    "type-graphql": "2.0.0-beta.4"
  }
}

and this index.js

import { registerEnumType } from 'type-graphql';

run node index.js

Expected Behavior

The app runs fine and do not throw.

Logs

import { registerEnumType } from 'type-graphql';
         ^^^^^^^^^^^^^^^^
SyntaxError: The requested module 'type-graphql' does not provide an export named 'registerEnumType'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

Environment (please complete the following information):

MichalLytek commented 6 months ago

Duplicate of #1598 🔒

lbevilacqua commented 6 months ago

Duplicate of #1598 🔒

Thank you and sorry for raising it. Next time I will search recently-closed issues too.