{ } qjs-modules

loaders/file

Source: lib/loaders/file.js (JS wrapper over registerHooks()) — default export: installFileLoader(); qjsm only

Makes with { type: 'file' } imports work as in Bun: the default export is the file's absolute path, and the file itself is never read or compiled. Opt-in: nothing is registered until it is called.

import installFileLoader from 'loaders/file';

installFileLoader();
const { default: source } = await import('./hello.c', { with: { type: 'file' } });
// "/abs/dir/hello.c"

A static import source from './hello.c' with { type: 'file' } works too, in a module that is loaded after installFileLoader() ran.

Runtimewith { type: 'file' }
Bundefault export is the absolute path (no bundling); namespace has default and __esModule
Node, Denounsupported (error)
qjsm + this loaderdefault export is the absolute path; no __esModule

Exports

ExportKindDescription
installFileLoader()functionRegisters the load hook; returns the registerHooks() result (deregister()).(default export)