rollup.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import resolve from "rollup-plugin-node-resolve";
  2. import commonjs from "rollup-plugin-commonjs";
  3. import babel from "rollup-plugin-babel";
  4. import pkg from "./package.json";
  5. export default [
  6. // browser-friendly UMD build
  7. {
  8. input: "index.js",
  9. output: {
  10. name: "d3",
  11. file: pkg.browser,
  12. format: "umd",
  13. },
  14. plugins: [
  15. resolve(),
  16. commonjs(),
  17. babel({
  18. exclude: ["node_modules/**"],
  19. }),
  20. ],
  21. },
  22. // CommonJS (for Node) and ES module (for bundlers) build.
  23. // (We could have three entries in the configuration array
  24. // instead of two, but it's quicker to generate multiple
  25. // builds from a single configuration where possible, using
  26. // an array for the `output` option, where we can specify
  27. // `file` and `format` for each target)
  28. {
  29. input: "index.js",
  30. external: [], // list dependencies here
  31. output: [
  32. { file: pkg.main, format: "cjs" },
  33. { file: pkg.module, format: "es" },
  34. ],
  35. plugins: [
  36. babel({
  37. exclude: ["node_modules/**"],
  38. }),
  39. ],
  40. },
  41. ];