← All Templates

npm Package

TypeScriptIntermediatePackages

Publishable npm package with TypeScript, tests, and bundling. Supports ESM and CommonJS.

Features

Code Preview

// package.json
{
  "name": "my-package",
  "version": "0.1.0",
  "type": "module",
  "exports": {
    ".": {
      "import": "./dist/index.js",
      "require": "./dist/index.cjs"
    }
  }
}

// src/index.ts
export function greet(name: string): string {
  return `Hello, ${name}!`;
}
Open in RoadCode

Related Templates

CLI Tool
JavaScript · Intermediate
Python Package
Python · Intermediate