Registry / devops / esbuild-coffeescript-rails

esbuild-coffeescript-rails

JSON →
library2.2.2jsnpmunverified

An esbuild plugin for importing CoffeeScript and Literate CoffeeScript (.litcoffee) files, designed to integrate with Rails Sprockets. The current stable version is 2.2.2. The plugin compiles CoffeeScript to JavaScript using the coffeescript compiler, supporting options like source maps, bare mode, and Babel transpilation. It is actively maintained and provides TypeScript definitions. This plugin is a niche tool for legacy or existing CoffeeScript projects that want to use esbuild as their bundler, offering a straightforward API and compatibility with the Rails asset pipeline.

npm install esbuild-coffeescript-rails
INSTALL
IMPORT
SIG · ESBUILD-COFFEESCRI
E
esbuild-coffeescript-rails
devopsjavascriptv2.2.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

default
import coffeeScriptPlugin from 'esbuild-coffeescript-rails'
const coffeePlugin = require('esbuild-coffeescript-rails').default
ESM default export; CommonJS require returns the plugin function directly.
coffeeScriptPlugin
const coffeeScriptPlugin = require('esbuild-coffeescript-rails')
const { coffeeScriptPlugin } = require('esbuild-coffeescript-rails')
CommonJS require gives the plugin function as the default, not as a named export.
CoffeeScriptOptions
import type { CoffeeScriptOptions } from 'esbuild-coffeescript-rails'
TypeScript type import for configuration options; available since TypeScript types are shipped.

Demonstrates using the plugin with esbuild to bundle a CoffeeScript entry point.

// build.js const coffeeScriptPlugin = require('esbuild-coffeescript-rails'); require('esbuild').build({ entryPoints: ['main.coffee'], bundle: true, outfile: 'out.js', plugins: [coffeeScriptPlugin()], });
Debug
Known issues
breakingVersion 2.x changed the export to not require .default in CommonJS.
fix
Use require('esbuild-coffeescript-rails') directly without .default.
affects: <2.0.0
deprecatedThe `header` option is deprecated in CoffeeScript 2+ and may be removed.
fix
Avoid using `header: true`; set to false or omit.
affects: >=2.0.0
gotchaThe plugin does not support JSX or TypeScript; those must be handled by other esbuild plugins.
fix
Use separate plugins or preprocessors for JSX/TS before CoffeeScript compilation.
affects: all
gotchaSource maps generated by CoffeeScript may not be fully compatible with esbuild's pipeline; consider using `inlineMap` option.
fix
Set `inlineMap: true` in plugin options for better source map integration.
affects: all
breakingDropped support for Node.js versions <12 in version 2.x.
fix
Upgrade Node.js to version 12 or higher.
affects: >=2.0.0
Errors
Common errors & fixes
Error: Cannot find module 'esbuild-coffeescript-rails'
Package not installed or incorrect import path.
fix
Run `npm install --save-dev esbuild-coffeescript-rails` and ensure the import path is correct.
TypeError: coffeeScriptPlugin is not a function
Using the plugin incorrectly (e.g., importing default when not needed).
fix
Use `require('esbuild-coffeescript-rails')` (CommonJS) or `import coffeeScriptPlugin from 'esbuild-coffeescript-rails'` (ESM).
Error: The service returned an error: Could not resolve 'main.coffee'
The CoffeeScript file path is incorrect or the plugin is not applied.
fix
Ensure the entry point path is correct relative to build.js, and that the plugin is included in the plugins array.
Upgrade
Version history
2.2.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
esbuild-coffeescript-rails — npm install esbuild-coffeescript-rails · libregistry