esbuild-coffeescript
TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

esbuild-coffeescript

esbuild-coffeescript

This plugin lets you import CoffeeScript files when bundling with Esbuild

Installation

$ npm install --save-dev esbuild-coffeescript

Compatibility

This plugin is tested against Node.js versions 20.x, 22.x, and 24.x.

Getting Started

main.coffee

answer = 42
console.log("the answer is #{answer}")

build.js

import coffeeScriptPlugin from 'esbuild-coffeescript';
import esbuild from 'esbuild';

esbuild.build({
  entryPoints: ['main.coffee'],
  bundle: true,
  outfile: 'out.js',
  plugins: [coffeeScriptPlugin()],
}).catch(() => process.exit(1));

Configuration

An object containing configuration options may be passed into the plugin constructor coffeeScriptPlugin.

coffeeScriptPlugin({
  bare: true,
});

The following options are available:

  • options.inlineMap, boolean: if true, output the source map as a base64-encoded string in a comment at the bottom.
  • options.filename, string: the filename to use for the source map. It can include a path (relative or absolute).
  • options.bare, boolean: if true, output without the top-level function safety wrapper.
  • options.header, boolean: if true, output the Generated by CoffeeScript header.
  • options.transpile, object: if set, this must be an object with the options to pass to Babel. See Transpilation.
  • options.ast, boolean: if true, return an abstract syntax tree of the input CoffeeScript source code.
  • options.literate, boolean: if true, parses the code as Literate CoffeeScript. This allows you to write CoffeeScript embedded in Markdown, where indented blocks are treated as executable code.

But CoffeeScript is dead?

While it might seem like it, coffeescript is still downloaded over 1.6 million times every week. Coffeescript is still actively used and widespread, and this plugin provides a great way for these projects to leverage the great esbuild tooling.

/esbuild-coffeescript/

    Package Sidebar

    Install

    npm i esbuild-coffeescript

    Weekly Downloads

    3,658

    Version

    3.0.0

    License

    MIT

    Unpacked Size

    6.61 kB

    Total Files

    4

    Last publish

    Collaborators

    • johnie