rollup.config.ts 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import resolve from 'rollup-plugin-node-resolve';
  2. import commonjs from 'rollup-plugin-commonjs';
  3. import sourceMaps from 'rollup-plugin-sourcemaps';
  4. import camelCase from 'lodash.camelcase';
  5. import typescript from 'rollup-plugin-typescript2';
  6. import json from 'rollup-plugin-json';
  7. const pkg = require('./package.json');
  8. const libraryName = '@notabug/peer';
  9. export default {
  10. input: `src/${libraryName}.ts`,
  11. output: [
  12. { file: pkg.main, name: camelCase(libraryName), format: 'umd', sourcemap: true },
  13. { file: pkg.module, format: 'es', sourcemap: true }
  14. ],
  15. // Indicate here external modules you don't wanna include in your bundle (i.e.: 'lodash')
  16. external: [
  17. 'argon2',
  18. 'fast-memoize',
  19. '@notabug/gun-scope',
  20. '@notabug/gun-suppressor',
  21. '@notabug/gun-suppressor-sear',
  22. 'object-hash',
  23. 'query-string',
  24. 'ramda',
  25. 'route-parser',
  26. 'uri-js'
  27. ],
  28. watch: {
  29. include: 'src/**'
  30. },
  31. plugins: [
  32. // Allow json resolution
  33. json(),
  34. // Compile TypeScript files
  35. typescript({ useTsconfigDeclarationDir: true }),
  36. // Allow bundling cjs modules (unlike webpack, rollup doesn't understand cjs)
  37. commonjs(),
  38. // Allow node_modules resolution, so you can use 'external' to control
  39. // which external modules to include in the bundle
  40. // https://github.com/rollup/rollup-plugin-node-resolve#usage
  41. resolve(),
  42. // Resolve source maps to the original source
  43. sourceMaps()
  44. ]
  45. };