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

TypeScript CommonJS/ESM #411

Open
rmuchall-sepa opened this issue May 17, 2024 · 4 comments
Open

TypeScript CommonJS/ESM #411

rmuchall-sepa opened this issue May 17, 2024 · 4 comments
Assignees

Comments

@rmuchall-sepa
Copy link

rmuchall-sepa commented May 17, 2024

Hi there,

If possible, please could you consider making RedisStore a named export?

export class RedisStore extends Store {

At the moment, with the default only export it is not possible to use connect-redis in a TypeScript shared library with interoptability between CommonJS and ESM.
This is because of the way TypeScript transpiles between CommonJs/ESM.

// Original TypeScript (default export)
import RedisStore from "connect-redis";

// Transpiled to ESM (works correctly)
import RedisStore from "connect-redis";

// Transpiled to CJS (broken)
const RedisStore = require("common-js"); // note the missing .default

If RedisStore is a named export then the code becomes:

// Original TypeScript (named export)
import {RedisStore} from "connect-redis";

// Transpiled to ESM (works correctly)
import {RedisStore} from "connect-redis";

// Transpiled to CJS (works correctly)
const RedisStore = require("connect-redis");
const store = new RedisStore.RedisStore(...);

Thanks for your consideration :)

@wavded wavded self-assigned this May 20, 2024
@wavded
Copy link
Collaborator

wavded commented May 20, 2024

This is on my radar for the next release. Thanks for reporting!

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jun 20, 2024
@wavded wavded removed the stale label Jun 20, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Jul 21, 2024
@wavded wavded removed the stale label Jul 26, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 26, 2024
@wavded wavded removed the stale label Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants