Modern rollup with coffeescript. Sourced from lautis/rollup-plugin-coffee-script, refactored and updated libraries.
Allow CoffeeScript code to be included in Rollup bundles without introducing an additional build step.
npm install --save-dev @bkuri/rollup-plugin-coffeescript
# or
yarn add -D @bkuri/rollup-plugin-coffeescript
# or
pnpm install -D @bkuri/rollup-plugin-coffeescript
// rollup.config.js
import coffee from '@bkuri/rollup-plugin-coffeescript'
export default {
input: 'main.coffee',
plugins: [
coffee()
]
}
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
(and optionally .litcoffee
and .md
) to extensions
.
import coffee from '@bkuri/rollup-plugin-coffeescript'
import commonjs from '@rollup/plugin-commonjs'
import nodeResolve from '@rollup/plugin-node-resolve'
const extensions = [ '.coffee', '.js', '.litcoffee', '.md' ]
export default {
input: 'main.coffee',
plugins: [
coffee(),
commonjs({ extensions }),
nodeResolve({ extensions })
]
}