An Introduction to Rome: Facebook’s Experimental JavaScript Toolchain
Rome, an experimental JavaScript toolchain announced by Facebook in February 2020, combines a compiler, linter, formatter, bundler, and test runner written in TypeScript, offers a unified CLI with commands such as analyzeDependencies, bundle, lint, and provides detailed usage examples and instructions for building and running the project.
On February 27, 2020, Facebook open‑sourced Rome, an experimental JavaScript toolchain created by Sebastian McKenzie, the author of Babel and Yarn and a member of the React Native team. Before becoming an official Facebook project, Rome was essentially McKenzie’s personal project.
Rome’s repository is located at https://github.com/facebookexperimental/rome . The project has undergone several name changes: it started as Sonic in 2016, then became Hydra , and finally was renamed Rome in March 2019, referencing the many metaphors associated with the city of Rome.
According to the project description, Rome is an experimental JavaScript toolchain that includes a compiler, linter, formatter, bundler, and test framework, aiming to become a comprehensive solution for handling JavaScript source code. All components are written from scratch in TypeScript, have no third‑party dependencies, and are organized as internal packages within a single monorepo.
Key Features
All tools are self‑hosted and can compile themselves.
Supports JSX, Flow, and TypeScript annotations.
Current focus is on linting (see issue 20 ).
Command‑Line Interface
Rome provides a rich set of commands, grouped by purpose:
Source‑code commands
analyzeDependencies : Analyze and output a file’s dependencies.
bundle : Bundle JavaScript into a single file.
compile : Compile a JavaScript file.
develop : Start a web server.
parse : Parse a file and output its AST.
resolve : Resolve a file path.
Code‑quality commands
ci : Install dependencies, run linter and tests.
lint : Run the linter on a set of files.
test : Execute tests.
Process‑management commands
restart , start , status , stop , web
Project‑management commands
config , publish (TODO), run (TODO)
Internal commands
evict : Evict a file from the memory cache.
logs
rage
Example Usage
A minimal example shows how a module export is transformed during bundling:
export const myVar = 'hello';Another module imports this export:
import { myVar } from './moduleA.mjs';Running the bundler:
rome bundle module.mjs distThe generated bundle wraps all modules in a single closure, similar to Rollup, rather than creating a separate closure per module as Webpack does.
Running Rome
Because Rome has not been published to npm, you must build it from source:
git clone [email protected]:facebookexperimental/rome.git cd rome scripts/dev‑rome --helpThese commands display the full help output, listing all available flags and sub‑commands.
References
Rome project: https://github.com/facebookexperimental/rome
Announcement article: https://jasonformat.com/rome-javascript-toolchain/
Twitter thread on the name change: https://twitter.com/sebmck/status/1108408813864906752
360 Tech Engineering
Official tech channel of 360, building the most professional technology aggregation platform for the brand.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.