BABEL.JS(1)
π BABEL.JS π
okay bestie, sit down, hydrate, because we're talking about babel.js β the compiler for writing next generation JavaScript β¨ It's a User Command, it lives in section 1 of the manual (the one for actual commands you type, iykyk), and honestly? it's giving main character energy in every JS build pipeline ever. π
πΈ NAME πΈ
babel.js β the compiler for writing next generation JavaScript π¦
Like, you write the fancy new syntax, and babel just handles it. No cap. π
β¨ SYNOPSIS β¨
babel [options] <files ...>
that's it, that's the whole vibe. options go in, files go in, out comes β¨compiledβ¨ JavaScript. π«Ά
π OPTIONS π
okay so here's the full menu, and yes we're going through every single one because you deserve the whole tea, not a summary. π
-f,--filename [filename]β the filename to use when reading from stdin. this shows up in source-maps, errors, etc. so like, when your code is screaming at you, at least it knows your name π₯Ί--presets [list]β a comma-separated list of preset names. (comma-separated! don't be out here writing spaces like a menace) π--plugins [list]β a comma-separated list of plugin names. same deal, commas, bestie π--config-file [path]β path to a.babelrcfile to use. point it at your config and go π--env-name [name]β the name of the'env'to use when loading configs and plugins. defaults to the value ofBABEL_ENV, or elseNODE_ENV, or else'development'. so the fallback chain is:BABEL_ENVβNODE_ENVβ'development'. periodt. π₯--root-mode [mode]β the project-root resolution mode. one of'root'(that's the default, the standard, the moment),'upward', or'upward-optional'. β--source-type [script|module]β yeah so that's the option,scriptormodule, and that's literally all it says. no extra description, we move. π--no-babelrcβ whether or not to look up.babelrcand.babelignorefiles. π§--ignore [list]β list of glob paths to not compile. emphasis on the not, bestie, these ones get skipped π--only [list]β list of glob paths to only compile. the exclusive list. the VIP section. π--no-highlight-codeβ enable or disable ANSI syntax highlighting of code frames. it's on by default, so this is how you turn the sparkle off β¨--no-commentsβ write comments to generated output. it'strueby default. yeah the flag is named "no-comments" and the description says "write comments" β I know, I know, that's literally just how it's written, I'm not touching it π--retain-linesβ retain line numbers. and the manpage itself says this will result in really ugly code. their words, not mine. you have been warned π--compact [true|false|auto]β do not include superfluous whitespace characters and line terminators. tightening it up, slimming it down π--minifiedβ save as many bytes when printing.falseby default. when you want it smol. π--auxiliary-comment-before [string]β print a comment before any injected non-user code. (the code that babel added, not yours) π¬--auxiliary-comment-after [string]β print a comment after any injected non-user code. π¬-s,--source-maps [true|false|inline|both]β that's the option, those are the values, no further description given. four choices, pick your fighter π--source-map-target [string]β setfileon the returned source map. π―--source-file-name [string]β setsources[0]on the returned source map. yes, specifically index zero. π―--source-root [filename]β the root from which all sources are relative. the origin point, the home base π--module-root [filename]β optional prefix for the AMD module formatter that will be prepended to the filename on module definitions. π§©-M,--module-idsβ insert an explicit id for modules. no more guessing, the modules get names π--module-id [string]β specify a custom name for module ids. you pick the name, bestie π-x,--extensions [extensions]β list of extensions to compile when a directory has been the input. the default set is[.js,.jsx,.es6,.es,.mjs,.cjs]π--keep-file-extensionβ preserve the file extensions of the input files. don't rename my babies π₯Ί-w,--watchβ recompile files on changes. it's literally watching. it sees everything. π--skip-initial-buildβ do not compile files before watching. just watch. no initial build. π€«-o,--out-file [out]β compile all input files into a single file. everything, together, one file π«Ά-d,--out-dir [out]β compile an input directory of modules into an output directory. folder in, folder out π--relativeβ compile into an output directory relative to input directory or file. requires--out-dir [out]so like, don't try it without that one, it needs its partner π«-D,--copy-filesβ when compiling a directory, copy over non-compilable files. don't leave the stragglers behind π--include-dotfilesβ include dotfiles when compiling and copying non-compilable files. yes, even the ones starting with a dot, they're invited too π--no-copy-ignoredβ exclude ignored files when copying non-compilable files. if it's ignored, it stays ignored, no exceptions π«--verboseβ log everything. this option conflicts with--quietβ οΈ pick a side, bestie--quietβ don't log anything. this option conflicts with--verboseβ οΈ yeah, same conflict, other direction--delete-dir-on-startβ delete the out directory before compilation. clean slate, fresh start, no baggage π§Ή--out-file-extension [string]β use a specific extension for the output files. π·οΈ-V,--versionβ output the version number π’-h,--helpβ display help for command. (hi, that's me, I'm the help) πβοΈ
quick reminder bestie:--verboseand--quietliterally conflict with each other, so don't pass both unless you're trying to start drama in your terminal π
and that's the whole page, no skips, no cuts, every flag accounted for π
this was babel.js, version 7.20.15+ds1+~cs214.2..., from February 2025, and yeah that version string is a whole mouthful but we love her anyway πΈ thanks for reading, go compile something cute, mwah π
β¨π¦
π¦ where this page comes from
- debian trixie: node-babel7 7.20.15+ds1+~cs214.269.168-8 Β· MIT
- ubuntu questing: node-babel7 7.20.15+ds1+~cs214.269.168-8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms