W3cubDocs

/webpack 2

coffee-loader

Install

npm install --save-dev coffee-loader

Usage

import coffee from 'coffee-loader!./file.coffee';
import coffee from 'file.coffee';

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.coffee$/,
        use: [ 'coffee-loader' ]
      }
    ]
  }
}

Options

Name
Default
Description
Name
literate
Default
false
Description
Enable CoffeeScript in Markdown (Code Blocks) e.g file.coffee.md
Name
sourceMap
Default
false
Description
Enable/Disable Sourcemaps

Literate

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.coffee.md$/,
        use: [
          {
            loader: 'coffee-loader',
            options: { literate: true }
          }
        ]
      }
    ]
  }
}

Sourcemaps

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.coffee$/,
        use: [
          {
            loader: 'coffee-loader',
            options: { sourceMap: true }
          }
        ]
      }
    ]
  }
}

© 2012–2016 Tobias Koppers
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/loaders/coffee-loader/