Last active
February 14, 2018 05:11
-
-
Save zebulonj/b817521207e8966f5ab487ed6b9a4823 to your computer and use it in GitHub Desktop.
Canonical Rollup Configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resolve from 'rollup-plugin-node-resolve'; | |
import commonjs from 'rollup-plugin-commonjs'; | |
import babel from 'rollup-plugin-babel'; | |
import uglify from 'rollup-plugin-uglify'; | |
import pkg from './package.json'; | |
export default [{ | |
input : './index.js', | |
output: [ | |
{ | |
name: 'bundle', | |
file: pkg.browser, | |
format: 'umd' | |
} | |
], | |
plugins: [ | |
resolve(), | |
babel({ | |
presets: [ | |
[ | |
"env", { | |
"targets": { | |
"browsers": ["last 2 versions", "safari >= 7"] | |
}, | |
"modules": false | |
} | |
], | |
"stage-1" | |
], | |
plugins: ["external-helpers"] | |
}), | |
commonjs() | |
] | |
}, { | |
input : './index.js', | |
output: [ | |
{ | |
name: 'bundle', | |
file: pkg.browser.replace( '.js', '.min.js' ), | |
format: 'umd' | |
} | |
], | |
plugins: [ | |
resolve(), | |
babel({ | |
presets: [ | |
[ | |
"env", { | |
"targets": { | |
"browsers": ["last 2 versions", "safari >= 7"] | |
}, | |
"modules": false | |
} | |
], | |
"stage-1" | |
], | |
plugins: ["external-helpers"] | |
}), | |
commonjs(), | |
uglify() | |
] | |
}, { | |
input: './index.js', | |
external: (id) => !!id.match(/^babel-runtime/i), | |
output: [ | |
{ | |
file: pkg.main, | |
format: 'cjs' | |
}, { | |
file: pkg.module, | |
format: 'es' | |
} | |
], | |
plugins: [ | |
resolve(), | |
babel({ | |
runtimeHelpers: true, | |
presets: [ | |
[ | |
"env", { | |
"targets": { | |
"browsers": ["last 2 versions", "safari >= 7"] | |
}, | |
"modules": false | |
} | |
], | |
"stage-1" | |
], | |
plugins: ["transform-runtime"] | |
}), | |
commonjs() | |
] | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment