A Node.js custom ESM loader that mimics the TypeScript compiler's module resolution algorithm, enabling seamless use of TypeScript path aliases (e.g., paths and baseUrl in tsconfig.json) at runtime without a post-compile step. Version 0.0.1 is the initial and only release. It works by reading tsconfig.json automatically, eliminating the need for manual configuration. Unlike tsc-alias, which requires additional setup and may have bugs, this loader provides a direct, zero-config solution. Note: custom ESM loaders remain experimental in Node.js.
npm install tsc-module-loaderNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to install the loader, configure path aliases in tsconfig.json, compile TypeScript, and run with the ESM loader to resolve aliases at runtime.
Use Node.js >=18.19 or >=20.0 for --experimental-loader support. Monitor Node.js changelog for changes to loader behavior.
Upgrade Node.js to v18.19.0+, v20.0.0+, or v21.0.0+.
Ensure your entry point and imported files are ES modules (type: 'module' in package.json or .mjs extension).
Use a newer Node.js version (>=18.19.0 or >=20.0.0) and ensure the flag is spelled correctly.
Run 'npm install tsc-module-loader' in your project root. If using a monorepo, ensure the package is installed in the same directory as the execution.
Ensure you have TypeScript installed as a dependency (npm install typescript) and use a compatible version. The loader was tested with TypeScript 4.x.