Skip to content

Feature: Mix CommonJS and ESM like Bun.js #49664

Answered by bnoordhuis
eldoy asked this question in General
Discussion options

You must be logged in to vote

It's spread out over a lot of issues, there's no single discussion I can link you to, but the crux is this: you cannot with 100% certainty determine if JS code is CJS or ESM. What you can do is let loose some heuristics and get it right most of the time but wrong some of the time (bun), or make it explicit (node.)

Bun's take-up is currently a rounding error compared to node and therefore the downsides to making an educated guess aren't very apparent yet but I fully expect that if and when it gets popular, this particular decision will come back to bite it in the, ah, buns.

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
7 replies
@eldoy
Comment options

@bnoordhuis
Comment options

Answer selected by eldoy
@xieyuheng
Comment options

@bnoordhuis
Comment options

@xieyuheng
Comment options

@meyfa
Comment options

Comment options

You must be logged in to vote
3 replies
@bnoordhuis
Comment options

@xieyuheng
Comment options

@bnoordhuis
Comment options

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