N1kto/rollup-plugin-coffee-react(opens in a new tab)
Language: JavaScript
Rollup plugin to transpile .coffee and .cjsx files
- stars
- 7
- watchers
- 2
- forks
- 0
- open issues
- 0
- Last updated
- 07/22/2016
Language: JavaScript
Rollup plugin to transpile .coffee and .cjsx files
Basically this is a simple wrapper around coffee-react-transform.
It enables rollup to bundle your .cjsx files.
It also transpiles regular .coffee files.
Install it with npm install rollup-plugin-coffee-react
Then in your rollup.config.js:
import coffeeReact from 'rollup-plugin-coffee-react' export default { dest: 'build/app.js', entry: 'src/index.js', plugins: [ coffeeReact({ exclude: 'node_modules/**' }) ] }
Since coffee-script compiles into ES5 code, you'll use this plugin in tandem with commonjs and node-resolve plugins.
Just don't forget to add .coffee, .cjsx to mentioned plugins' extensions option. For example:
import coffeeReact from 'rollup-plugin-coffee-react' import commonjs from 'rollup-plugin-commonjs' export default { dest: 'build/app.js', entry: 'src/index.js', plugins: [ coffeeReact({ exclude: 'node_modules/**' }), nodeResolve({ main: true, browser: true, extensions: [ '.js', '.coffee', '.csjx' ] }), commonjs({ extensions: [ '.js', '.coffee', '.cjsx' ] }) ] }
Rollup's include, exclude plugin options are supported.
You can also pass options for coffee-script to configure coffee -> js transpiling. Please refer to coffee-script documentation for details.