Registry / devops / coffee-loader

coffee-loader

JSON →
library5.0.0jsnpmunverified

Webpack loader that compiles CoffeeScript (>=2.0.0) to JavaScript. Current stable version is 5.0.0 (January 2024). Maintained by webpack-contrib under the webpack ecosystem. Active development, follows semver with major bumps for Node.js version increases. Key differentiators: official webpack loader, seamless integration with webpack's module system, supports CoffeeScript's `transpile` option for Babel integration, and respects `compiler.devtool` for source maps.

npm install coffee-loader
INSTALL
IMPORT
SIG · COFFEE-LOADER
C
coffee-loader
devopsjavascriptv5.0.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.

coffee-loader
module.exports = { module: { rules: [ { test: /\.coffee$/, loader: 'coffee-loader' } ] } }
const loader = require('coffee-loader')
Used as webpack loader string, not directly imported.
import coffee from 'coffee-loader!./file.coffee'
import coffee from 'coffee-loader!./file.coffee'
import coffee from './file.coffee'
Inline loader syntax for specific imports.
options
options: { bare: true, transpile: { presets: ['@babel/env'] } }
options: { sourceMap: true }
sourceMap is derived from devtool; do not set explicitly unless overriding.

Basic webpack configuration to compile CoffeeScript files using coffee-loader.

// webpack.config.js module.exports = { module: { rules: [ { test: /\.coffee$/, loader: 'coffee-loader', options: { bare: true, }, }, ], }, }; // file.coffee square = (x) -> x * x // Run: npx webpack
Debug
Known issues
breakingNode.js version <18.12.0 is no longer supported in v5.0.0
fix
Upgrade Node.js to >=18.12.0.
affects: >=5.0.0
breakingWebpack 4 and below require older versions of coffee-loader (v1.x or below).
fix
Use coffee-loader v1.x for webpack 4, or upgrade to webpack 5.
affects: <2.0.0
gotchaCoffeeScript 2+ required; v5.0.0 does not support CoffeeScript 1.x.
fix
Install coffeescript@^2.0.0.
affects: >=5.0.0
gotchaDefault option `bare` is `true`, which omits the top-level function wrapper. This may break variable scope if not expected.
fix
Set `options.bare: false` if you need the wrapper.
affects: >=1.0.0
deprecatedThe `transpile` option is still supported but Babel is now the recommended transpiler.
fix
Use Babel presets with `transpile` option or configure Babel in webpack separately.
affects: >=0.9.0
Errors
Common errors & fixes
Module not found: Error: Can't resolve 'coffee-script' in ...
Missing or incorrect CoffeeScript package name; coffee-loader expects 'coffeescript' (not 'coffee-script').
fix
Run npm install --save-dev coffeescript and ensure it's in node_modules.
Error: No valid options for coffee-loader, check 'bare', 'transpile', etc.
Invalid options object passed to coffee-loader.
fix
Check documentation for allowed options; common mistake: using 'sourceMap' directly instead of relying on devtool.
ValidationError: Invalid options object. Coffee Loader has been initialized using an options object that does not match the API schema.
Misspelled option names or incorrect type.
fix
Refer to schema-utils validation messages; typical issue: 'transpile' must be an object, not a string.
Error: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file.
Webpack rule for .coffee files is missing or incorrect.
fix
Add { test: /\.coffee$/, use: 'coffee-loader' } to module.rules.
Upgrade
Version history
5.0.0latest on npm
Audit
Dependencies
coffeescriptrequiredPeer dependency required to compile CoffeeScript files.
webpackrequiredPeer dependency; this is a webpack loader.
@babel/coreoptionalOptional dependency if using `transpile` option for Babel transformation.
@babel/preset-envoptionalOptional if using Babel transpilation.
Agent activity
6 hits · last 30 days
node
6
Resources
coffee-loader — npm install coffee-loader · libregistry