Karma preprocessor to bundle ES2015 modules using Rollup.
Features
- Rebundles your files when watched dependencies change
- Caches bundle output for improved performance
- Maintained with by @jlmakes
Installation
npm install karma-rollup-preprocessor
Configuration
All the options detailed in the Rollup Documentation can be passed to rollupPreprocessor
.
Standard
Below is a well-founded recommendation using the Bublé ES2015 transpiler:
module.exports = function(config) {
config.set({
files: [
{ pattern: 'test/**/*.spec.js', watched: false },
],
preprocessors: {
'test/**/*.spec.js': ['rollup'],
},
rollupPreprocessor: {
plugins: [require('rollup-plugin-buble')()],
output: {
format: 'iife',
name: '<your_project>',
sourcemap: 'inline',
},
},
})
}
Configured Preprocessors
Below shows an example where configured preprocessors can be very helpful:
module.exports = function(config) {
config.set({
files: [{ pattern: 'test/**/*.spec.js', watched: false }],
preprocessors: {
'test/buble/**/*.spec.js': ['rollup'],
'test/babel/**/*.spec.js': ['rollupBabel'],
},
rollupPreprocessor: {
plugins: [require('rollup-plugin-buble')()],
output: {
format: 'iife',
name: '<your_project>',
sourcemap: 'inline',
},
},
customPreprocessors: {
rollupBabel: {
base: 'rollup',
options: {
plugins: [require('rollup-plugin-babel')()],
},
},
},
})
}
Support
Supports all Rollup plug-ins, and works on Node 8
and up. Happy bundling!