rollup.config.js 678 B

12345678910111213141516171819202122232425262728293031
  1. import { readFileSync } from 'fs'
  2. import { join } from 'path'
  3. import { cwd } from 'process'
  4. import typescript from '@rollup/plugin-typescript'
  5. const pkg = JSON.parse(readFileSync(join(cwd(), 'package.json'), 'utf8'))
  6. export default {
  7. input: 'guest-js/index.ts',
  8. output: [
  9. {
  10. file: pkg.exports.import,
  11. format: 'esm'
  12. },
  13. {
  14. file: pkg.exports.require,
  15. format: 'cjs'
  16. }
  17. ],
  18. plugins: [
  19. typescript({
  20. declaration: true,
  21. declarationDir: `./${pkg.exports.import.split('/')[0]}`
  22. })
  23. ],
  24. external: [
  25. /^@tauri-apps\/api/,
  26. ...Object.keys(pkg.dependencies || {}),
  27. ...Object.keys(pkg.peerDependencies || {})
  28. ]
  29. }