-
Notifications
You must be signed in to change notification settings - Fork 186
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
Uncaught Error Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import #601
Comments
same issue |
The same problem also occurred on the |
changing the import fixed it for me:
|
SAVER
|
I have the same issue. package.json {
...
"type": "module",
"main": "index.js",
"scripts": {
...
"build": "rm -rf dist && swc src --out-dir dist --strip-leading-paths",
"start": "node dist/index.js"
}
... tsconfig.json {
"extends": "../../tsconfig.json",
"compilerOptions": {
"incremental": true,
"esModuleInterop": true,
"outDir": "dist",
"rootDir": "src",
"noEmit": false
}
} .swcrc {
"jsc": {
"parser": {
"syntax": "typescript",
"tsx": false,
"decorators": true
},
"transform": {
"legacyDecorator": true,
"decoratorMetadata": true
},
"target": "esnext"
},
"module": {
"type": "es6"
},
} |
as a workaround you can do. client.addEventHandler((message) => {
console.log(message);
}, new TelegramClient.events.NewMessage()); You don't need to import events like this. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try running on https://vercel.com/
/home/codespace/nvm/current/bin/node ./api/telegram.mjs
Process exited with code 1
Uncaught Error Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/workspaces/project_name/node_modules/telegram/sessions' is not supported resolving ES modules imported from /workspaces/project_name/api/telegram.mjs
Did you mean to import telegram/sessions/index.js?
at __node_internal_captureLargerStackTrace (node:internal/errors:497:5)
at NodeError (node:internal/errors:406:5)
at finalizeResolution (node:internal/modules/esm/resolve:227:11)
at moduleResolve (node:internal/modules/esm/resolve:845:10)
at defaultResolve (node:internal/modules/esm/resolve:1043:11)
at defaultResolve (node:internal/modules/esm/loader:383:12)
at resolve (node:internal/modules/esm/loader:352:25)
at getModuleJob (node:internal/modules/esm/loader:228:38)
at (node:internal/modules/esm/module_job:85:39)
at link (node:internal/modules/esm/module_job:84:36)
--- await ---
at runMainESM (node:internal/modules/run_main:53:21)
at executeUserEntryPoint (node:internal/modules/run_main:79:5)
at (node:internal/main/run_main_module:23:47)
The text was updated successfully, but these errors were encountered: