{"id":21055,"library":"coffee-loader","title":"coffee-loader","description":"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.","status":"active","version":"5.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/webpack-contrib/coffee-loader","tags":["javascript","webpack"],"install":[{"cmd":"npm install coffee-loader","lang":"bash","label":"npm"},{"cmd":"yarn add coffee-loader","lang":"bash","label":"yarn"},{"cmd":"pnpm add coffee-loader","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required to compile CoffeeScript files.","package":"coffeescript","optional":false},{"reason":"Peer dependency; this is a webpack loader.","package":"webpack","optional":false},{"reason":"Optional dependency if using `transpile` option for Babel transformation.","package":"@babel/core","optional":true},{"reason":"Optional if using Babel transpilation.","package":"@babel/preset-env","optional":true}],"imports":[{"note":"Used as webpack loader string, not directly imported.","wrong":"const loader = require('coffee-loader')","symbol":"coffee-loader","correct":"module.exports = { module: { rules: [ { test: /\\.coffee$/, loader: 'coffee-loader' } ] } }"},{"note":"Inline loader syntax for specific imports.","wrong":"import coffee from './file.coffee'","symbol":"import coffee from 'coffee-loader!./file.coffee'","correct":"import coffee from 'coffee-loader!./file.coffee'"},{"note":"sourceMap is derived from devtool; do not set explicitly unless overriding.","wrong":"options: { sourceMap: true }","symbol":"options","correct":"options: { bare: true, transpile: { presets: ['@babel/env'] } }"}],"quickstart":{"code":"// webpack.config.js\nmodule.exports = {\n  module: {\n    rules: [\n      {\n        test: /\\.coffee$/,\n        loader: 'coffee-loader',\n        options: {\n          bare: true,\n        },\n      },\n    ],\n  },\n};\n\n// file.coffee\nsquare = (x) -> x * x\n\n// Run: npx webpack","lang":"javascript","description":"Basic webpack configuration to compile CoffeeScript files using coffee-loader."},"warnings":[{"fix":"Upgrade Node.js to >=18.12.0.","message":"Node.js version <18.12.0 is no longer supported in v5.0.0","severity":"breaking","affected_versions":">=5.0.0"},{"fix":"Use coffee-loader v1.x for webpack 4, or upgrade to webpack 5.","message":"Webpack 4 and below require older versions of coffee-loader (v1.x or below).","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Install coffeescript@^2.0.0.","message":"CoffeeScript 2+ required; v5.0.0 does not support CoffeeScript 1.x.","severity":"gotcha","affected_versions":">=5.0.0"},{"fix":"Set `options.bare: false` if you need the wrapper.","message":"Default option `bare` is `true`, which omits the top-level function wrapper. This may break variable scope if not expected.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use Babel presets with `transpile` option or configure Babel in webpack separately.","message":"The `transpile` option is still supported but Babel is now the recommended transpiler.","severity":"deprecated","affected_versions":">=0.9.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run npm install --save-dev coffeescript and ensure it's in node_modules.","cause":"Missing or incorrect CoffeeScript package name; coffee-loader expects 'coffeescript' (not 'coffee-script').","error":"Module not found: Error: Can't resolve 'coffee-script' in ..."},{"fix":"Check documentation for allowed options; common mistake: using 'sourceMap' directly instead of relying on devtool.","cause":"Invalid options object passed to coffee-loader.","error":"Error: No valid options for coffee-loader, check 'bare', 'transpile', etc."},{"fix":"Refer to schema-utils validation messages; typical issue: 'transpile' must be an object, not a string.","cause":"Misspelled option names or incorrect type.","error":"ValidationError: Invalid options object. Coffee Loader has been initialized using an options object that does not match the API schema."},{"fix":"Add { test: /\\.coffee$/, use: 'coffee-loader' } to module.rules.","cause":"Webpack rule for .coffee files is missing or incorrect.","error":"Error: You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}