rollup.config.js 852 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import typescript from 'rollup-plugin-typescript2';
  2. import commonjs from 'rollup-plugin-commonjs';
  3. import external from 'rollup-plugin-peer-deps-external';
  4. import postcss from 'rollup-plugin-postcss';
  5. import resolve from 'rollup-plugin-node-resolve';
  6. import url from 'rollup-plugin-url';
  7. import svgr from '@svgr/rollup';
  8. import pkg from './package.json';
  9. export default {
  10. input: 'src/index.ts',
  11. output: [
  12. {
  13. file: pkg.main,
  14. format: 'cjs',
  15. exports: 'named',
  16. sourcemap: true,
  17. },
  18. {
  19. file: pkg.module,
  20. format: 'es',
  21. exports: 'named',
  22. sourcemap: true,
  23. },
  24. ],
  25. plugins: [
  26. external(),
  27. postcss({
  28. extract: `dist/index.css`,
  29. }),
  30. url(),
  31. svgr(),
  32. resolve(),
  33. typescript({
  34. rollupCommonJSResolveHack: true,
  35. clean: true,
  36. }),
  37. commonjs(),
  38. ],
  39. };