Skip to content

Instantly share code, notes, and snippets.

@lund0n
Created October 8, 2016 04:34
Show Gist options
  • Save lund0n/b0521a02296a563e6714219cb962d1c9 to your computer and use it in GitHub Desktop.
Save lund0n/b0521a02296a563e6714219cb962d1c9 to your computer and use it in GitHub Desktop.
Demonstrate use of CommonJS module in Rollup
// Just a couple of examples from the crypto-js README.
// run with `node bundle.js` after running the rollup build.
import CryptoJS from 'crypto-js';
import SHA256 from 'crypto-js/sha256';
console.log(CryptoJS.HmacSHA1('Message', 'Key'));
console.log(SHA256('Message'));
import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';
export default {
entry: 'index.js',
dest: 'bundle.js',
format: 'iife',
plugins: [
resolve(),
commonjs(),
],
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment