MJS2CJS(1)

πŸ’– MJS2CJS β€” the manual page, but make it slay πŸ’–

okay bestie, sit down, hydrate, and let me tell you about mjs2cjs β€” it's a little user command and it's honestly lowkey iconic. ✨


🌸 NAME 🌸

mjs2cjs β€” no cap, that's literally the name. mjs2cjs. That's it. That's the name. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

mjs2cjs <start_file>

πŸ¦‹ DESCRIPTION πŸ¦‹

so here's the tea: mjs2cjs uses a generic rollup.config.mjs to generate a commonjs file in the dist subdirectory. fr fr, that's the whole job. 🫢

and where does the output name come from? bestie it's extracted from package.json β€” specifically the "main" field β€” and if that's not there, it falls back to index.cjs. simple as. 🌈


✨ OPTIONS ✨

  • -b β€” ("bundle") πŸ’« build a bundle file
  • -o β€” ("out") πŸ“ outfile
  • -a β€” ("auto") πŸ€– automatically transform a "type:module" package into a mix of cjs/mjs

πŸ‘‘ a note about the -a option (read this one, bestie) πŸ‘‘

ngl this one is doing the most, and you need to know what it's doing:

  • it does not only build the commonjs file β€” it also modifies package.json. the audacity, honestly. 😭
  • and if a debian/index.cjs exists, it gets installed and used in the "package.json"->exports->require field. this lets you write a wrapper when the API changes. very main character of it. πŸ’…
  • option -a is usable if and only if the module is a pure ES module β€” aka it's declared as type:module in package.json. if it's not, it's a no. periodt. ⭐

  • Copyright Β© Yadd <yadd@debian.org> 🫢
  • Licensed under GPL-2+ (see /usr/share/common-licenses/GPL-2)

reminder bestie: -a literally rewrites your package.json, so know what you're signing up for before you send it. iykyk. πŸ™ˆ

and that's the whole page, angel! this was mjs2cjs 0.17.8, dated August 2026 β€” go forth and convert your modules, you absolute legend. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ”₯πŸ‘‘β­πŸ’œ

πŸ“¦ where this page comes from