Puppy Transpiler
raw JSON → 1.0.5 verified Fri May 01 auth: no javascript
Puppy Transpiler is a lightweight JavaScript/TypeScript transpiler that translates modern ES2020+ code to ES2015 for broader browser compatibility. Version 1.0.5 is the latest stable release, with monthly updates. It differentiates by supporting inline TypeScript without configuration and producing minimal output. Ships TypeScript types.
Common errors
error Error: Cannot find module 'puppy-transpiler' ↓
cause Package not installed or wrong import path.
fix
Run 'npm install puppy-transpiler' and ensure import is from 'puppy-transpiler'.
error TypeError: transpile is not a function ↓
cause Using default import incorrectly or wrong import style.
fix
Use 'import transpile from 'puppy-transpiler'' or 'import { transpile } from 'puppy-transpiler''.
error SyntaxError: Unexpected token 'export' ↓
cause Input contains ES modules syntax but target is set to a version that doesn't support it.
fix
Set 'target' to 'es2015' or higher to allow export statements.
Warnings
breaking Version 1.0.0 changed default target from 'es2016' to 'es2015'. ↓
fix Explicitly set 'target' option if you need a different target.
gotcha Transpiler cannot handle dynamic imports; will throw a syntax error. ↓
fix Use a bundler or another transpiler for dynamic imports.
deprecated Option 'module' is deprecated; use 'target' to control module output. ↓
fix Replace 'module: 'cjs'' with 'target: 'es2015''.
Install
npm install puppy-transpiler yarn add puppy-transpiler pnpm add puppy-transpiler Imports
- transpile wrong
const transpile = require('puppy-transpiler')correctimport { transpile } from 'puppy-transpiler' - default wrong
const { transpile } = require('puppy-transpiler')correctimport transpile from 'puppy-transpiler' - TranspileOptions wrong
import { TranspileOptions } from 'puppy-transpiler/types'correctimport { TranspileOptions } from 'puppy-transpiler'
Quickstart
import { transpile } from 'puppy-transpiler';
const es2020 = `const add = (a, b) => a + b;`;
const result = transpile(es2020, { target: 'es2015' });
console.log(result.code);
// Output: var add = function(a, b) { return a + b; };