Using Canivete with Rollup
1. In your project root folder, install Canivete via NPM.
$ npm install --save leofavre/canivete
2. Install Rollup globally via NPM.
$ npm install --global rollup
3. Install the Node Resolve Pulgin for Rollup via NPM.
$ npm install --save-dev rollup-plugin-node-resolve
4. Create a file named "rollup.config.js" with the following content:
import nodeResolve from "rollup-plugin-node-resolve";
export default {
"entry": "./index.js",
"dest": "./dist/app.js",
"plugins": [nodeResolve()],
"format": "es"
};
5. Create a file named "index.js". Import any dependencies from Canivete using ES6 module syntax before the rest of your code, like this:
import toAverage from "canivete/dist/toAverage";
const myArray = [8, 10, 12, 14, 16];
alert(myArray.reduce(toAverage));
// => 12
6. Use the following shell command to build your project:
$ rollup -c