exportGlobals.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import * as React from 'react';
  2. import ReactDOM from 'react-dom';
  3. import * as ReactRouter from 'react-router';
  4. import * as Sentry from '@sentry/react';
  5. import moment from 'moment';
  6. import PropTypes from 'prop-types';
  7. import Reflux from 'reflux';
  8. import plugins from 'sentry/plugins';
  9. const globals = {
  10. // The following globals are used in sentry-plugins webpack externals
  11. // configuration.
  12. PropTypes,
  13. React,
  14. Reflux,
  15. Sentry,
  16. moment,
  17. Router: ReactRouter,
  18. ReactDOM: {
  19. findDOMNode: ReactDOM.findDOMNode,
  20. render: ReactDOM.render,
  21. },
  22. // django templates make use of these globals
  23. SentryApp: {},
  24. };
  25. // The SentryApp global contains exported app modules for use in javascript
  26. // modules that are not compiled with the sentry bundle.
  27. const SentryApp = {
  28. // The following components are used in sentry-plugins.
  29. Form: require('sentry/components/deprecatedforms/form').default,
  30. FormState: require('sentry/components/forms/state').default,
  31. LoadingIndicator: require('sentry/components/loadingIndicator').default,
  32. plugins: {
  33. add: plugins.add,
  34. addContext: plugins.addContext,
  35. BasePlugin: plugins.BasePlugin,
  36. DefaultIssuePlugin: plugins.DefaultIssuePlugin,
  37. },
  38. // The following components are used in legacy django HTML views
  39. ConfigStore: require('sentry/stores/configStore').default,
  40. HookStore: require('sentry/stores/hookStore').default,
  41. Modal: require('sentry/actionCreators/modal'),
  42. getModalPortal: require('sentry/utils/getModalPortal').default,
  43. Client: require('sentry/api').Client,
  44. };
  45. globals.SentryApp = SentryApp;
  46. Object.keys(globals).forEach(name => (window[name] = globals[name]));
  47. export default globals;