rollup.config.js 940 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import { defineConfig } from 'rollup';
  2. import { nodeResolve } from '@rollup/plugin-node-resolve';
  3. import commonjs from '@rollup/plugin-commonjs';
  4. import terser from '@rollup/plugin-terser';
  5. export default defineConfig({
  6. input: 'src/main.js',
  7. output: [
  8. {
  9. file: 'dist/bundle-iife.js',
  10. format: 'iife',
  11. name: 'MonitorSDK',
  12. globals: {
  13. // 定义全局变量映射
  14. }
  15. },
  16. {
  17. file: 'dist/bundle-esm.js',
  18. format: 'esm'
  19. },
  20. {
  21. file: 'dist/bundle-cjs.js',
  22. format: 'cjs'
  23. },
  24. {
  25. file: 'dist/bundle-umd.js',
  26. format: 'umd',
  27. name: 'MonitorSDK'
  28. }
  29. ],
  30. plugins: [
  31. nodeResolve({
  32. browser: true
  33. }),
  34. commonjs(),
  35. terser({
  36. format: {
  37. comments: false
  38. },
  39. compress: {
  40. drop_console: true, // 生产环境移除console
  41. drop_debugger: true
  42. }
  43. })
  44. ],
  45. external: [] // 外部依赖
  46. });