rollup.config.js 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import commonjs from 'rollup-plugin-commonjs';
  2. import node from 'rollup-plugin-node-resolve';
  3. import typescript from 'rollup-plugin-typescript2';
  4. import { uglify } from 'rollup-plugin-uglify';
  5. import path from 'path';
  6. const { minify } = process.env
  7. export default {
  8. input: 'src/index.ts',
  9. plugins: [
  10. typescript({
  11. tsconfigOverride: {
  12. compilerOptions: {
  13. module: 'ES2015',
  14. declaration: false
  15. }
  16. }
  17. }),
  18. node(),
  19. commonjs({
  20. include: 'node_modules/**'
  21. })
  22. ].concat(minify ? uglify() : []),
  23. output: {
  24. extend: true,
  25. file: `dist/face-api${minify ? '.min' : ''}.js`,
  26. format: 'umd',
  27. name: 'faceapi',
  28. globals: {
  29. 'crypto': 'crypto'
  30. },
  31. sourcemap: minify ? false : true
  32. },
  33. external: ['crypto'],
  34. onwarn: (warning) => {
  35. const ignoreWarnings = ['CIRCULAR_DEPENDENCY', 'CIRCULAR', 'THIS_IS_UNDEFINED']
  36. if (ignoreWarnings.some(w => w === warning.code))
  37. return
  38. if (warning.missing === 'alea')
  39. return
  40. console.warn(warning.message)
  41. }
  42. }