Registry / devops / esbuild-coffeescript

esbuild-coffeescript

JSON →
library3.1.0jsnpmunverified

An esbuild plugin that enables importing and bundling CoffeeScript (.coffee, .litcoffee) files directly within esbuild builds. Current stable version is 3.1.0, updated regularly (multiple releases per year), peer dependency on esbuild >=0.25.9. Key differentiators: integrates CoffeeScript compilation directly into esbuild's pipeline, supports both regular and literate CoffeeScript, offers configurable options (bare, inlineMap), and is designed for Node.js environments. Ships TypeScript type definitions for a better development experience.

npm install esbuild-coffeescript
INSTALL
IMPORT
SIG · ESBUILD-COFFEESCRI
E
esbuild-coffeescript
devopsjavascriptv3.1.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18223 runs
build_error
glibc
node 18223 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import coffeeScriptPlugin from 'esbuild-coffeescript'
const coffeeScriptPlugin = require('esbuild-coffeescript')
The package is ESM-only since v3; CommonJS require() will fail.
coffeeScriptPlugin (named export)
import { coffeeScriptPlugin } from 'esbuild-coffeescript'
Also available as a named export for consistency with esbuild plugin conventions.
CoffeeScriptOptions (type)
import type { CoffeeScriptOptions } from 'esbuild-coffeescript'
import { CoffeeScriptOptions } from 'esbuild-coffeescript' (value import will cause runtime error)
TypeScript users should use type-only imports to avoid bundling runtime code.

Shows basic usage: import the plugin, pass it as an esbuild plugin, and bundle a CoffeeScript entry point.

import coffeeScriptPlugin from 'esbuild-coffeescript'; import esbuild from 'esbuild'; await esbuild.build({ entryPoints: ['src/main.coffee'], bundle: true, plugins: [coffeeScriptPlugin()], outfile: 'dist/bundle.js', }); // main.coffee content: // answer = 42 // console.log("the answer is #{answer}")
Debug
Known issues
breakingv3.0.0 drops Node.js <20 support and removes the CommonJS entry point; the package is now ESM-only.
fix
Upgrade to Node.js >=20 and use import syntax instead of require().
affects: >=2.x <3.0.0
breakingThe bare option default changed from false to true in v2.0.0, potentially breaking builds that relied on the IIFE wrapper.
fix
Set bare: false explicitly if you need the IIFE wrapper, or adjust your code to expect bare compilation.
affects: >=1.x <2.0.0
deprecatedPassing options via second argument (coffeeScriptPlugin({}, options)) was deprecated in v2.1.0 and removed in v3.0.0.
fix
Pass all options as the first argument: coffeeScriptPlugin({ bare: true, inlineMap: true }).
affects: >=2.1.0 <3.0.0
gotchaSource maps from CoffeeScript may not align perfectly with transformed JavaScript; disable inlineMap if you experience mapping issues.
fix
Set inlineMap: false and rely on esbuild's source map generation instead.
affects: >=1.0.0
gotchaThe plugin only handles .coffee and .litcoffee files; other CoffeeScript-like extensions (e.g., .coffee.md) are not recognized.
fix
Rename files to .litcoffee or manually configure additional extensions via CoffeeScript's register() function.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module /path/to/esbuild-coffeescript/index.js from /path/to/project/build.js not supported.
Using require() to import an ESM-only package in a CJS context.
fix
Convert your project to ESM (set type: 'module' in package.json) or use dynamic import: import('esbuild-coffeescript').then(m => m.default()).
TypeError: coffeeScriptPlugin is not a function
Incorrect import of the default export, e.g., using named import when default import is required.
fix
Use import coffeeScriptPlugin from 'esbuild-coffeescript' (default import) instead of import { coffeeScriptPlugin } from 'esbuild-coffeescript'.
Plugin 'esbuild-coffeescript' encountered an error: CoffeeScript version mismatch. Expected >=2.0.0, got 1.12.7
The plugin requires CoffeeScript 2.x or higher, but an older version is installed.
fix
Run npm install coffeescript@latest to upgrade CoffeeScript to version 2 or later.
Upgrade
Version history
3.1.0latest on npm
Audit
Dependencies
esbuildrequiredpeer dependency; core bundler required to run the plugin
Agent activity
4 hits · last 30 days
node
4
Resources
esbuild-coffeescript — npm install esbuild-coffeescript · libregistry