rollup.config.js 941 B

12345678910111213141516171819202122232425262728293031323334353637
  1. import commonjs from 'rollup-plugin-commonjs';
  2. import resolve from 'rollup-plugin-node-resolve';
  3. import { terser } from 'rollup-plugin-terser';
  4. import typescript from 'rollup-plugin-typescript2';
  5. import postcss from 'rollup-plugin-postcss';
  6. import babel from '@rollup/plugin-babel';
  7. export default {
  8. input: 'src/index.ts',
  9. output: [
  10. {
  11. file: 'dist/library.js',
  12. format: 'cjs',
  13. sourcemap: true,
  14. },
  15. {
  16. file: 'dist/library.min.js',
  17. format: 'cjs',
  18. sourcemap: true,
  19. plugins: [terser()],
  20. },
  21. ],
  22. plugins: [
  23. babel({
  24. babelHelpers: 'bundled',
  25. exclude: 'node_modules/**', // Exclude any unnecessary directories
  26. }),
  27. resolve(),
  28. commonjs(),
  29. typescript({
  30. tsconfig: 'tsconfig.json',
  31. allowImportPathExtension: true,
  32. }),
  33. postcss()
  34. ],
  35. external: ['react', 'react-dom', 'react/jsx-runtime'], // Specify any external dependencies here
  36. };