Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] ESM undefined is not constructor #523

Open
filename24 opened this issue Jul 24, 2023 · 1 comment
Open

[BUG] ESM undefined is not constructor #523

filename24 opened this issue Jul 24, 2023 · 1 comment

Comments

@filename24
Copy link
Contributor

Please explain the bug!

esm 코드를 실하게 되면

[Module: null prototype] {
  Client: [Getter], Commands: [Getter], Utils: [Getter]
}

가 아닌

[Module: null prototype] {
  default: { Client: [Getter], Commands: [Getter], Utils: [Getter] }
}

로 나오게 됩니다. esm 을 정상적으로 인식하지 않는 오류입니다.

참고로 import { Client } from 'dokdo' 로 import 하였습니다

Relevant log output

TypeError  undefined is not a constructor
error stack:
  • \Users\anhge\Desktop\Developemt\djs-template\src\structures\BotClient.ts    BotClient.<instance_members_initializer>
        \Users\anhge\Desktop\Developemt\djs-template\src\structures\BotClient.ts:40
  • \Users\anhge\Desktop\Developemt\djs-template\src\structures\BotClient.ts    BotClient
        \Users\anhge\Desktop\Developemt\djs-template\src\structures\BotClient.ts:48
  • \Users\anhge\Desktop\Developemt\djs-template\src\bot.ts     <anonymous>
        \Users\anhge\Desktop\Developemt\djs-template\src\bot.ts:14
  • module_job  ModuleJob.run
        internal\modules\esm\module_job:193
  •

  • loader      async ESMLoader.import
        internal\modules\esm\loader:530

What steps do you need to take to make this bug reproduced?

  • Step 1. setting esm setup
  • Step 2. run code
  • Step 3. see error

Dokdo Version

v1.0.1

Node.js / Discord.js Version

v16.19.0 / 14.11.0

@filename24
Copy link
Contributor Author

diff --git a/package.json b/package.json
index c4767972038320b664c412357caa222f3c9f8a9d..c0c3f11b655dd9fa8f1271d98d9ba21d190fbf12 100644
--- a/package.json
+++ b/package.json
@@ -2,6 +2,7 @@
   "name": "dokdo",
   "version": "1.0.1",
   "description": "Dokdo. Easy Discord bot debuging tool.",
+  "type": "module",
   "scripts": {
     "build": "tsup",
     "dev": "yarn test:bot",

변하면 해결이되었습니다. 코드 반영해야할거같습니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant