rollup.config.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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: "./webviewer.js",
  9. output: [
  10. {
  11. format: "es",
  12. name: 'ComPDFKitViewer',
  13. file: "../webview/lib/webview.min.js",
  14. sourcemap: false
  15. }
  16. // {
  17. // format: "es",
  18. // name: 'ComPDFKitViewer',
  19. // file: "./dist/webviewer.js",
  20. // sourcemap: false
  21. // }
  22. ],
  23. plugins: [
  24. json(),
  25. nodeResolve({
  26. preferBuiltins: true,
  27. mainFields: ['browser']
  28. }),
  29. commonjs(),
  30. (uglify()),
  31. // (process.env === 'production' && uglify()),
  32. babel({
  33. exclude: 'node_modules/**', // 防止打包node_modules下的文件
  34. // 使用预设
  35. presets: [['@babel/preset-env', {
  36. "modules": false,
  37. // 目标浏览器
  38. "targets": {
  39. "edge": '17',
  40. "firefox": '60',
  41. "chrome": '67',
  42. "safari": '10.0',
  43. 'ie': '10',
  44. },
  45. }]]
  46. })
  47. ],
  48. sourcemap: false
  49. };