Skip to content

Instantly share code, notes, and snippets.

@nicohq
Created May 25, 2017 08:08
Show Gist options
  • Save nicohq/fb1795ba013b7b7e653092a1efa3db58 to your computer and use it in GitHub Desktop.
Save nicohq/fb1795ba013b7b7e653092a1efa3db58 to your computer and use it in GitHub Desktop.
Rollup config
import builtins from 'rollup-plugin-node-builtins';
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-js-harmony';
const isProd = process.env.NODE_ENV === 'prod';
export default {
entry: 'app.js',
format: 'iife',
moduleName: 'MWLRedirector',
context: 'window',
plugins: [
resolve({
module: true,
jsnext: true,
main: true,
browser: true,
extensions: ['.js']
}),
builtins(),
babel({
babelrc: false,
sourceMap: !isProd,
exclude: 'node_modules/**', // only transpile our source code
presets: [
["latest", { "es2015": { "modules": false } }]
],
plugins: [
['external-helpers']
]
}),
(isProd ? uglify({}, minify) : '')
],
dest: isProd ? 'build/mirror.min.js' : 'build/dest.js',
sourceMap: !isProd
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment