Skip to content

Instantly share code, notes, and snippets.

@garraflavatra
Last active July 9, 2021 15:06
Show Gist options
  • Save garraflavatra/8605d9d076305d4c826d1b7db842101a to your computer and use it in GitHub Desktop.
Save garraflavatra/8605d9d076305d4c826d1b7db842101a to your computer and use it in GitHub Desktop.
Rollup config for React library (no TypeScript)
import babel from "@rollup/plugin-babel";
import external from "rollup-plugin-peer-deps-external";
import del from "rollup-plugin-delete";
import { terser } from "rollup-plugin-terser";
import pkg from "./package.json";
export default {
input: pkg.source,
output: [
{ file: pkg.main, format: "cjs" },
{ file: pkg.module, format: "esm" },
],
plugins: [
external(),
babel({
exclude: "node_modules/**",
}),
terser(),
del({ targets: ["dist/*"] }),
],
external: Object.keys(pkg.peerDependencies || {}),
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment