rollup.config.js 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import nodeResolve from '@rollup/plugin-node-resolve'
  2. import commonjs from "@rollup/plugin-commonjs"
  3. import babel from '@rollup/plugin-babel'
  4. import { uglify } from 'rollup-plugin-uglify'
  5. import json from '@rollup/plugin-json';
  6. export default {
  7. input: "./src/index.js",
  8. // input: "./math.js",
  9. output: [
  10. {
  11. format: "es",
  12. name: 'ComPDFKitViewer',
  13. file: "../webviewer/lib/webview.min.js",
  14. sourcemap: false
  15. }
  16. ],
  17. plugins: [
  18. json(),
  19. nodeResolve({
  20. preferBuiltins: true,
  21. mainFields: ['browser']
  22. }),
  23. commonjs(),
  24. // (uglify()),
  25. // (process.env === 'production' && uglify()),
  26. babel({
  27. exclude: 'node_modules/**', // 防止打包node_modules下的文件
  28. // 使用预设
  29. presets: [['@babel/preset-env', {
  30. "modules": false,
  31. // 目标浏览器
  32. "targets": {
  33. "edge": '17',
  34. "firefox": '60',
  35. "chrome": '67',
  36. "safari": '10.0',
  37. 'ie': '10',
  38. },
  39. }]]
  40. })
  41. ],
  42. sourcemap: false
  43. };