Registry / devops / alamode

alamode

JSON →
library3.7.1jsnpmunverified

A RegExp-based transpiler for Node.js that converts ES import/export statements to CommonJS require/module.exports and supports JSX, with zero dependencies. Current stable version is 3.7.1, released with irregular cadence. Differentiators: minimal transformation preserving line numbers and original code structure, no interop wrappers, no dependency on Babel or AST, making it lightweight and fast. Suitable for projects that only need simple module transpilation without full ES module semantics.

npm install alamode
INSTALL
IMPORT
SIG · ALAMODE
A
alamode
devopsjavascriptv3.7.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import alamode from 'alamode'
const alamode = require('alamode')
The library is ESM-only and exports a default transpile function.
transpile
import { transpile } from 'alamode'
const { transpile } = require('alamode')
Named export available, but ESM-only.
alamode
const alamode = require('alamode')
import alamode from 'alamode'
When using CommonJS require, default export is assigned to module.exports, so require returns the transpile function directly.

Transpiles a simple ES module with import and export to CommonJS using alamode's default export.

import alamode from 'alamode'; const source = ` import { join } from 'path'; export const greet = (name) => `Hello, ${name}!`; `; const result = alamode(source); console.log(result.code); // Output: // const { join } = require('path'); // const greet = (name) => `Hello, ${name}!`; // module.exports.greet = greet;
Debug
Known issues
gotchaalamode does not handle dynamic imports (import()) or re-exports (export * from). It only supports static import/export statements.
fix
For dynamic imports, use native ESM or a more complete transpiler. For re-exports, rewrite as individual exports.
affects: >=0.0.0
gotchaThe require hook (--require alamode/register) only affects .js files, not .mjs or .cjs. It also does not transform files in node_modules by default.
fix
Explicitly include files via --require with full path or use the CLI for building.
affects: >=3.0.0
gotchaJSX transpilation does not support source maps and may break on complex JSX expressions (e.g., spread attributes, fragments).
fix
Review transpiled JSX output; consider using Babel for complex JSX.
affects: >=3.0.0
deprecatedThe '--harmony' flag or older Node.js versions (<10) may cause syntax errors due to unsupported ES features.
fix
Use Node.js >=10 for full support.
affects: >=0.0.0
Errors
Common errors & fixes
SyntaxError: unknown keyword export
alamode did not transpile the file (e.g., not using require hook or CLI), or the file is not matched by the require hook pattern.
fix
Ensure the file is processed by alamode: use CLI or require hook with correct extension (.js). Check that the source code uses static import/export.
Cannot find module 'alamode'
alamode is not installed or not in the require path.
fix
Run 'npm install alamode' or 'yarn add alamode'. Ensure node_modules is accessible.
TypeError: alamode is not a function
Using wrong import style: default import vs named import.
fix
Use 'import alamode from 'alamode'' (default) or 'const alamode = require('alamode').default' (CJS).
Upgrade
Version history
3.7.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
21 hits · last 30 days
node
18
Resources
alamode — npm install alamode · libregistry