rollup.config.mjs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. import bundleSize from '@atomico/rollup-plugin-sizes'
  2. import { visualizer } from 'rollup-plugin-visualizer'
  3. import license from 'rollup-plugin-license'
  4. import esbuild from 'rollup-plugin-esbuild'
  5. import dts from "rollup-plugin-dts";
  6. import pkg from "./package.json" assert { type: "json" }
  7. import typescript from "@rollup/plugin-typescript";
  8. import json from '@rollup/plugin-json';
  9. const sharedOutput = {
  10. name: '@tabler/icons',
  11. sourcemap: true,
  12. }
  13. const sharedPlugins = [
  14. license({
  15. banner: `${pkg.name} v${pkg.version} - ${pkg.license}`
  16. }),
  17. bundleSize(),
  18. visualizer({
  19. sourcemap: false,
  20. filename: `stats/${pkg.name}.html`
  21. }),
  22. typescript({ tsconfig: "./tsconfig.json" }),
  23. json()
  24. ]
  25. export default [
  26. {
  27. input: "src/index.ts",
  28. output: [
  29. {
  30. ...sharedOutput,
  31. file: pkg.main,
  32. format: "cjs",
  33. },
  34. {
  35. ...sharedOutput,
  36. file: pkg.module,
  37. format: "esm",
  38. },
  39. {
  40. file: pkg['main:es'],
  41. format: "es",
  42. ...sharedOutput,
  43. },
  44. {
  45. file: pkg['main:umd'],
  46. format: "umd",
  47. ...sharedOutput,
  48. }
  49. ],
  50. plugins: [
  51. ...sharedPlugins,
  52. esbuild()
  53. ]
  54. },
  55. {
  56. input: "src/index.ts",
  57. output: [
  58. {
  59. ...sharedOutput,
  60. file: pkg['main:umd:min'],
  61. format: 'umd',
  62. },
  63. ],
  64. plugins: [
  65. ...sharedPlugins,
  66. esbuild({
  67. minify: true
  68. })
  69. ]
  70. },
  71. {
  72. input: "dist/esm/types/index.d.ts",
  73. output: [
  74. {
  75. file: "dist/index.d.ts",
  76. format: "esm"
  77. }
  78. ],
  79. plugins: [
  80. dts(),
  81. json()
  82. ]
  83. },
  84. ];