MichalLytek / type-graphql

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!

Home Page:https://typegraphql.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

lbevilacqua opened this issue · comments

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):

  • OS: AWS Lambda/Debian Bullseye dev container (macOS host)
  • Node 18 LTS
  • Package version 2.0.0-beta.4 (the issue does not occur on 2.0.0-beta.3)
  • TypeScript version 5.2.2

Duplicate of #1598 🔒

Duplicate of #1598 🔒

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