rollup.config.js 865 B

12345678910111213141516171819202122232425262728
  1. // import resolve from 'rollup-plugin-node-resolve';
  2. // import commonjs from 'rollup-plugin-commonjs';
  3. import typescript from 'rollup-plugin-typescript2'; // 一定要是typescript2,如果使用typescript,没法自动生成.d.ts文件
  4. // import { terser } from 'rollup-plugin-terser';
  5. import pkg from './package.json';
  6. export default [
  7. // UMD for browser
  8. /* {
  9. input: 'src/index.ts',
  10. output: {
  11. name: 'howLongUntilLunch',
  12. file: pkg.browser,
  13. format: 'umd',
  14. },
  15. plugins: [resolve(), commonjs(), typescript(), terser()], // 浏览器使用的代码文件进行简化
  16. }, */
  17. // CommonJS for Node and ES module for bundlers build
  18. {
  19. input: 'src/index.ts',
  20. external: ['ms'],
  21. plugins: [typescript()],
  22. output: [
  23. { file: pkg.main, format: 'cjs' },
  24. // { file: pkg.module, format: 'es' },
  25. ],
  26. },
  27. ];