tscraft

raw JSON →
0.0.1 verified Fri May 01 auth: no javascript

A TypeScript transpiler and bundler with minimal dependencies. Currently at version 0.0.1 with slow release cadence. Targets Node >=8.5.0. Differentiates itself as a lightweight alternative to larger build tools like webpack or rollup, though still in early development with no documentation or community adoption.

error Cannot find module 'tscraft'
cause Package not installed or ESM import used in CJS context.
fix
Run 'npm install tscraft' and ensure project is ESM-enabled (type: 'module' in package.json).
error SyntaxError: Unexpected token 'export'
cause Attempting to use ESM 'import' in a CommonJS file without ESM support.
fix
Add 'type': 'module' to package.json or rename file to .mjs.
error TypeError: tscraft is not a function
cause Using default import incorrectly; default export may be an object.
fix
Use named imports: import { transpile } from 'tscraft'.
breaking No CommonJS (require) support; all imports must be ESM.
fix Use ESM imports with 'import' syntax and ensure your project is configured for ESM (type: 'module' in package.json).
deprecated Default export may be renamed in future versions; use named exports for stability.
fix Prefer import { transpile } from 'tscraft' over import tscraft from 'tscraft'.
gotcha Engine requirement Node >=8.5.0 may cause issues on older systems.
fix Upgrade Node.js to version 8.5.0 or later.
npm install tscraft
yarn add tscraft
pnpm add tscraft

Shows transpile and bundle usage with type annotations.

import tscraft from 'tscraft';
import { transpile, bundle } from 'tscraft';

const code = `const x: number = 1;`;

// Transpile TypeScript to JavaScript
const result = transpile(code, { target: 'es2015' });
console.log(result.code);

// Bundle multiple files
const bundleResult = bundle({
  entry: 'src/index.ts',
  output: 'dist/bundle.js'
});
console.log(bundleResult);

// Use default export (same as transpile)
const defaultResult = tscraft(code, { target: 'es2020' });