rollup.config.mjs 1.7 KB

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