rollup.config.js 749 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import typescriptPlugin from 'rollup-plugin-typescript2';
  2. import typescript from 'typescript';
  3. const globals = {
  4. __proto__: null,
  5. tslib: "tslib",
  6. };
  7. function external(id) {
  8. return id in globals;
  9. }
  10. export default [{
  11. input: "src/invariant.ts",
  12. external,
  13. output: {
  14. file: "lib/invariant.esm.js",
  15. format: "esm",
  16. sourcemap: true,
  17. globals,
  18. },
  19. plugins: [
  20. typescriptPlugin({
  21. typescript,
  22. tsconfig: "./tsconfig.rollup.json",
  23. }),
  24. ],
  25. }, {
  26. input: "lib/invariant.esm.js",
  27. external,
  28. output: {
  29. // Intentionally overwrite the invariant.js file written by tsc:
  30. file: "lib/invariant.js",
  31. format: "cjs",
  32. exports: "named",
  33. sourcemap: true,
  34. name: "ts-invariant",
  35. globals,
  36. },
  37. }];