env.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. Object.defineProperty(exports, '__esModule', { value: true });
  2. /*
  3. * This module exists for optimizations in the build process through rollup and terser. We define some global
  4. * constants, which can be overridden during build. By guarding certain pieces of code with functions that return these
  5. * constants, we can control whether or not they appear in the final bundle. (Any code guarded by a false condition will
  6. * never run, and will hence be dropped during treeshaking.) The two primary uses for this are stripping out calls to
  7. * `logger` and preventing node-related code from appearing in browser bundles.
  8. *
  9. * Attention:
  10. * This file should not be used to define constants/flags that are intended to be used for tree-shaking conducted by
  11. * users. These flags should live in their respective packages, as we identified user tooling (specifically webpack)
  12. * having issues tree-shaking these constants across package boundaries.
  13. * An example for this is the __SENTRY_DEBUG__ constant. It is declared in each package individually because we want
  14. * users to be able to shake away expressions that it guards.
  15. */
  16. /**
  17. * Figures out if we're building a browser bundle.
  18. *
  19. * @returns true if this is a browser bundle build.
  20. */
  21. function isBrowserBundle() {
  22. return typeof __SENTRY_BROWSER_BUNDLE__ !== 'undefined' && !!__SENTRY_BROWSER_BUNDLE__;
  23. }
  24. /**
  25. * Get source of SDK.
  26. */
  27. function getSDKSource() {
  28. // @ts-expect-error "npm" is injected by rollup during build process
  29. return "npm";
  30. }
  31. exports.getSDKSource = getSDKSource;
  32. exports.isBrowserBundle = isBrowserBundle;
  33. //# sourceMappingURL=env.js.map