Created
December 19, 2020 08:59
-
-
Save wise-introvert/2c76ae9aeec6ddb294111f11acf78ad1 to your computer and use it in GitHub Desktop.
Config I use to setup rollup in my component libraries for React
This file contains 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 typescript from "rollup-plugin-typescript2"; | |
import { terser } from "rollup-plugin-terser"; | |
import pkg from "./package.json"; | |
export default { | |
input: "src/index.tsx", | |
output: [ | |
{ | |
file: pkg.main, | |
format: "cjs", | |
}, | |
{ | |
file: pkg.module, | |
format: "es", | |
}, | |
], | |
external: [ | |
...Object.keys(pkg.dependencies || {}), | |
...Object.keys(pkg.peerDependencies || {}), | |
], | |
plugins: [typescript(), terser()], | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment