Karma preprocessor to bundle ES2015 modules using Rollup.
- Rebundles your files when watched dependencies change
- Caches bundle output for improved performance
- Maintained with by @jlmakes
npm install karma-rollup-preprocessor --save-dev
All the options detailed in the Rollup Documentation can be passed to rollupPreprocessor
.
Below is a well-founded recommendation using the Bublé ES2015 transpiler:
// karma.conf.js
module.exports = function (config) {
config.set({
files: [
// watch src files for changes but
// don't load them into the browser.
{ pattern: 'src/**/*.js', included: false },
'test/**/*.spec.js',
],
preprocessors: {
'src/**/*.js': ['rollup'],
'test/**/*.spec.js': ['rollup'],
},
rollupPreprocessor: {
plugins: [
require('rollup-plugin-buble')(),
],
format: 'iife', // helps prevent naming collisions
moduleName: '<your_project>', // required for 'iife' format
sourceMap: 'inline', // sensible for testing
},
});
};
Supports all Rollup plug-ins, and works on Node 0.12.x
and up. Happy bundling!