rollup.config.ts 620 B

123456789101112131415161718192021222324252627282930
  1. import json from '@rollup/plugin-json';
  2. import typescript from '@rollup/plugin-typescript';
  3. import terser from '@rollup/plugin-terser';
  4. import { readFileSync } from 'fs';
  5. const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
  6. const external = Object.keys(pkg.dependencies);
  7. export default {
  8. input: 'src/index.ts',
  9. output: [
  10. {
  11. dir: 'dist',
  12. format: 'es',
  13. file: pkg['main'],
  14. sourcemap: true,
  15. compact: true
  16. }
  17. ],
  18. external: external,
  19. plugins: [
  20. typescript({
  21. declaration: true,
  22. declarationDir: 'dist',
  23. rootDir: 'src',
  24. tsconfig: './tsconfig.json'
  25. }),
  26. json(),
  27. terser()
  28. ]
  29. };