Skip to content

TypeScript CommonJS/ESM #411

@rmuchall-sepa

Description

@rmuchall-sepa

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions