Integration between Rollup and CoffeeScript 2.
Allow CoffeeScript code to be included in Rollup bundles without introducing an additional build step.
npm install --save-dev rollup-plugin-coffee-script
# or
yarn add -D rollup-plugin-coffee-script
// rollup.config.js
import coffeescript from 'rollup-plugin-coffee-script';
export default {
input: 'main.coffee',
plugins: [
coffeescript()
]
}
CoffeeScript plugin accepts options.include
and options.exclude
(each a
minimatch pattern, or array of minimatch patterns) to determine which files are
compiled by CoffeeScript. By default, all files are transpiled.
The CoffeeScript plugin doesn't resolve requires. Instead,
use rollup-plugin-commonjs
and add .coffee
to extensions.
import commonjs from 'rollup-plugin-commonjs';
import coffee from 'rollup-plugin-coffee-script';
import nodeResolve from 'rollup-plugin-node-resolve';
export default {
input: 'main.coffee',
plugins: [
coffee(),
nodeResolve({ extensions: ['.js', '.coffee'] }),
commonjs({
extensions: ['.js', '.coffee']
})
]
}