Skip to content

Instantly share code, notes, and snippets.

@wise-introvert
Created December 19, 2020 08:59
Show Gist options
  • Save wise-introvert/2c76ae9aeec6ddb294111f11acf78ad1 to your computer and use it in GitHub Desktop.
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
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