Last active
July 9, 2021 15:06
-
-
Save garraflavatra/8605d9d076305d4c826d1b7db842101a to your computer and use it in GitHub Desktop.
Rollup config for React library (no TypeScript)
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 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