future-node
raw JSON → 0.0.2 verified Fri May 01 auth: no javascript abandoned
A Node.js require hook that allows modules to specify their own transpilers via package.json configuration, inspired by browserify transform system. Version 0.0.2 is in early development with no specific release cadence. It replaces Node's built-in extension hooks with a flexible transpiler pipeline, enabling per-file transpilation options. Bundled with an ES2016 transpiler for convenience. Unlike babel-register or ts-node, it decouples transpiler selection from the main application, letting dependencies declare their own transforms. Lacks active maintenance and usage is minimal.
Common errors
error Error: Cannot find module 'future-node' ↓
cause Module not installed or not in node_modules.
fix
Run 'npm install future-node' in project root.
error TypeError: future_node is not a function ↓
cause Attempt to import or assign require('future-node') to variable; it modifies require.extensions, does not export anything.
fix
Use 'require('future-node')' as a bare require, no assignment.
error SyntaxError: Unexpected token import ↓
cause transpile config missing for .js files with ES modules; Node does not support import natively.
fix
Add transpile entry for '*.js' with a babel transform that handles ES module syntax.
Warnings
deprecated Package is effectively abandoned since 2016. No updates, no support for modern Node versions (>=12). ↓
fix Use babel-register or esm for Node transpilation instead.
gotcha The bundled ES2016 transpiler '!sourcegraph/babel->js' expects a non-standard syntax derived from Sourcegraph browser build tooling. ↓
fix Use standard babel-preset-env with babel-register for predictable behavior.
gotcha Transpile patterns are glob-like but not standard globs; they match file extensions only, not full paths. ↓
fix Use patterns like '*.js' not 'src/**/*.js'.
Install
npm install future-node yarn add future-node pnpm add future-node Imports
- future-node wrong
import 'future-node'correctrequire('future-node') - CLI wrong
npm run future-node my-appcorrectnpx future-node my-app - transpile config in package.json wrong
{"transpile":{"*.js":"babel"}}correct{"transpile":[["*.js","!sourcegraph/babel->js",{"stage":0}]]}
Quickstart
// Install: npm install future-node
// Create app.js
require('future-node');
const fn = () => 'Hello from future-node!';
console.log(fn());
// In package.json, enable transpilation:
{
"transpile": [
["*.js", "!sourcegraph/babel->js", {"stage": 0}]
]
}
// Run: node app.js