- Dead-simple installation and setup:
npm install --save reify,require("reify") - Works with every version of Node.
- Put
importandexportstatements anywhere you like.- They're just statements.
- If you have a philosophical preference for restricting them to the top-level, there are plenty of ways to enforce that.
- This library doesn't limit you either way.
- Imported symbols are just normal variables.
- Debuggers and dev tools display the symbols as you wrote them, unmangled by a transpiler.
- Not having to rename variables references leads to much faster compilation.
- Variables are confined to the scope where they were imported.
importstatements work in the Node REPL.
- Any existing module or package can be imported.
- Babel's
interopRequire{Default,Wildcard}logic is captured byModule.prototype.getExportByName.
- Babel's
- Does not interfere with existing
require.extensionshooks. - Much simpler transform implementation as compared with other ECMASCript module compilers.
importstatements become calls tomodule.importSync(id, setters)exportstatements become assignments to theexportsobject.- The compiler doesn't have to parse the entire file to find
importandexportstatements.
- Line numbers are strictly preserved.
- No hoisting of
importstatements. - All
importandexportstatements are compiled in-place.
- No hoisting of
- No need for
Object.defineProperty-style getters to supportexport * from "...". - The
module.importSync(id, setters)API is human-writable, too, if you want to implement custom update logic. - Generated code is statically analyzable, since the
exportsobject is not exposed.