rollup.config.js 876 B

123456789101112131415161718192021222324252627282930313233
  1. import { terser } from 'rollup-plugin-terser';
  2. /**
  3. * Regarding "(!) `this` has been rewritten to `undefined`" warning:
  4. * It occurs because of typescript's Object.assign polyfill, which uses
  5. * `this` on the global scope. If you set `context: 'window'` in the rollup
  6. * config, it will silence the warning, but it will cause issues if CountUp
  7. * is not run in the browser. Allowing rollup to rewrite this to undefined
  8. * on just the global scope is harmless and doesn't break anything.
  9. */
  10. export default [
  11. // minified build
  12. {
  13. input: 'dist/countUp.js',
  14. output: {
  15. file: 'dist/countUp.min.js',
  16. },
  17. plugins: [
  18. terser(), // minify the output
  19. ],
  20. },
  21. // UMD build
  22. {
  23. input: 'dist/countUp.js',
  24. output: {
  25. file: 'dist/countUp.umd.js',
  26. name: 'countUp',
  27. format: 'umd',
  28. },
  29. plugins: [
  30. terser(),
  31. ],
  32. }
  33. ];