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 support #459

Open
productdevbook opened this issue Dec 16, 2022 · 3 comments · May be fixed by #565 or #505
Open

bug: esm support #459

productdevbook opened this issue Dec 16, 2022 · 3 comments · May be fixed by #565 or #505

Comments

@productdevbook
Copy link

node_modules/ts-node/dist-raw/node-internal-modules-esm-resolve.js:362
    const err = new ERR_UNSUPPORTED_DIR_IMPORT(path, fileURLToPath(base));

/node_modules/supertokens-node/recipe/session
CustomError: ERR_UNSUPPORTED_DIR_IMPORT

pnpm ts-node --esm --swc --transpile-only ./index.ts

❯ node -v
v18.12.1

"ts-node": "^10.9.1",

TypeScript 4.9.4

@productdevbook productdevbook changed the title esm support bug: esm support Dec 16, 2022
@productdevbook
Copy link
Author

import Session from 'supertokens-node/recipe/session/index.js'

change import and fixed

@productdevbook productdevbook linked a pull request Mar 4, 2023 that will close this issue
17 tasks
@productdevbook productdevbook linked a pull request May 13, 2023 that will close this issue
@ermish
Copy link

ermish commented Dec 2, 2023

any updates for esm support?

@krinoid
Copy link

krinoid commented Mar 25, 2024

Per #783, it's possible to use supertokens in ESM env with proper imports (with .js extension), e.g.:

import supertokens from "supertokens-node";
import Session from "supertokens-node/recipe/session/index.js";
import EmailPassword from "supertokens-node/recipe/emailpassword/index.js";
import { plugin as superTokensPlugin } from "supertokens-node/framework/fastify/index.js";
import { errorHandler as superTokensErrorHandler } from "supertokens-node/framework/fastify/index.js";

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