rollup.config.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import terser from '@rollup/plugin-terser';
  2. import json from "@rollup/plugin-json";
  3. import replace from "@rollup/plugin-replace";
  4. export default [
  5. {
  6. input: "node-index.js",
  7. output: [
  8. {
  9. file: "dist/node.cjs",
  10. format: "cjs",
  11. sourcemap: true
  12. }
  13. ]
  14. },
  15. {
  16. input: "index.js",
  17. output: {
  18. file: "dist/index.js",
  19. format: "umd",
  20. name: "msgpackr",
  21. sourcemap: true
  22. }
  23. },
  24. {
  25. input: "index.js",
  26. plugins: [
  27. replace({ Function: 'BlockedFunction '})
  28. ],
  29. output: {
  30. file: "dist/index-no-eval.cjs",
  31. format: "umd",
  32. name: "msgpackr",
  33. sourcemap: true
  34. },
  35. },
  36. {
  37. input: "unpack.js",
  38. plugins: [
  39. replace({ Function: 'BlockedFunction '})
  40. ],
  41. output: {
  42. file: "dist/unpack-no-eval.cjs",
  43. format: "umd",
  44. name: "msgpackr",
  45. sourcemap: true
  46. },
  47. },
  48. {
  49. input: "index.js",
  50. plugins: [
  51. terser({})
  52. ],
  53. output: {
  54. file: "dist/index.min.js",
  55. format: "umd",
  56. name: "msgpackr",
  57. sourcemap: true
  58. }
  59. },
  60. {
  61. input: "index.js",
  62. plugins: [
  63. replace({ Function: 'BlockedFunction '}),
  64. terser({})
  65. ],
  66. output: {
  67. file: "dist/index-no-eval.min.js",
  68. format: "umd",
  69. name: "msgpackr",
  70. sourcemap: true
  71. }
  72. },
  73. {
  74. input: "tests/test.js",
  75. plugins: [json()],
  76. external: ['chai', '../index.js'],
  77. output: {
  78. file: "dist/test.js",
  79. format: "iife",
  80. sourcemap: true,
  81. globals: {
  82. chai: 'chai',
  83. './index.js': 'msgpackr',
  84. },
  85. }
  86. }
  87. ];