node-redis icon indicating copy to clipboard operation
node-redis copied to clipboard

Provide esm version

Open tobiasdiez opened this issue 2 years ago • 5 comments

Motivation

With more and more build tools (vite, nuxt, etc) going towards an esm-first build, it would be nice if a proper esm interface could be provided, i.e. transpile and distribute esm version, including correct export declaration in package.json.

Basic Code Example

No response

tobiasdiez avatar Mar 04 '23 04:03 tobiasdiez

@tobiasdiez is there a way to do it without doubling the "Unpacked Size"?

leibale avatar Mar 13 '23 12:03 leibale

No not really, you do need to distribute both versions. But the metric "unpacked size" is misleading anyway, since distributing an esm version would actually allow bundlers to treeshake effectively so that the effective size for peoples apps decreases.

tobiasdiez avatar Mar 13 '23 14:03 tobiasdiez

@tobiasdiez I assume most people do not bundle the server code, let alone tree-shaking.. maybe in this new world of "edge functions" I'm incorrect..?

leibale avatar Mar 14 '23 01:03 leibale

Yes, reducing the distribution size is particularly important for edge/serverless, but more generally many popular fullstack frameworks like next or nuxt run the server build through webpack or vite, and they would profit from esm support.

tobiasdiez avatar Mar 14 '23 03:03 tobiasdiez

I propose Solidis as an alternative solution to this problem.

jay-l-e-e avatar May 17 '25 11:05 jay-l-e-e