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
muslnode 18–223 runs
build_error
glibcnode 18–223 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
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').
fixRun 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.
fixCheck 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.
fixRefer 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.
fixAdd { test: /\.coffee$/, use: 'coffee-loader' } to module.rules. 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.