Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// CommonJS (Node.js legacy) const fs = require("fs"); const { add } = require("./math"); module.exports = { greet }; // ES Modules (modern standard) import fs from "fs"; import { add } from "./math.js"; export { greet }; // Key differences: // ESM: static analysis, tree-shakable, async // CJS: dynamic require(), synchronous, widely used in npm
Result
Open