Switch to ESM#59
Conversation
|
Hi! What are you doing that motivates this? |
|
Sorry, forgot to write.. See updated PR description. |
|
And what are you trying to achieve in Prettier? I’m not sure what you want to show with the screenshot. |
|
ESbuild bundles CJS files like this And ESM files are like To me, the code is nicer. I'm sending this since I thought you are open to ES modules, but it's fine if you don't want to accept. |
|
I am open to ES modules, but I would rather switch to ESM-only than doubling the package size. So far, I haven’t really seen the benefit of making that breaking change, but since Node.js supports |
|
Done |
| import jsTokens from "js-tokens"; | ||
| // or: | ||
| const jsTokens = require("js-tokens"); | ||
| const jsTokens = require("js-tokens").default; // Requires Node.js 20.19.0 or later. |
There was a problem hiding this comment.
Should we add module.exports? https://nodejs.org/api/esm.html#commonjs-namespaces
|
Released in v10.0.0. Thanks for the nudge and the help! |

@babel/code-frame@8 is now in ESM, reasonable to ship this module in ESM?