exportGlobals.tsx 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 'app/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('app/components/forms/form').default,
  30. FormState: require('app/components/forms/index').FormState,
  31. LoadingIndicator: require('app/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('app/stores/configStore').default,
  40. HookStore: require('app/stores/hookStore').default,
  41. Modal: require('app/actionCreators/modal'),
  42. getModalPortal: require('app/utils/getModalPortal').default,
  43. };
  44. globals.SentryApp = SentryApp;
  45. Object.keys(globals).forEach(name => (window[name] = globals[name]));
  46. export default globals;