@bkuri/rollup-plugin-coffeescript
v0.4.2
Published
Modern CoffeeScript support for Rollup.
Downloads
243
Maintainers
Readme
rollup-plugin-coffeescript
Modern rollup with coffeescript. Sourced from lautis/rollup-plugin-coffee-script, refactored and updated libraries.
Why?
Allow CoffeeScript code to be included in Rollup bundles without introducing an additional build step.
Installation
npm install --save-dev @bkuri/rollup-plugin-coffeescript
# or
yarn add -D @bkuri/rollup-plugin-coffeescript
# or
pnpm install -D @bkuri/rollup-plugin-coffeescript
Usage
// 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.
Integration with CommonJS modules
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 })
]
}