coffee-loader

coffee-loader

Loads CoffeeScript like JavaScript

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
literate
false
Enable CoffeeScript in Markdown (Code Blocks) e.g file.coffee.md
sourceMap
false
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 }
          }
        ]
      }
    ]
  }
}

© JS Foundation and other contributors
Licensed under the Creative Commons Attribution License 4.0.
https://webpack.js.org/loaders/coffee-loader

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部