diff --git a/site/theme/template/Layout/index.jsx b/site/theme/template/Layout/index.jsx index 252b464bbd..86db4f7557 100644 --- a/site/theme/template/Layout/index.jsx +++ b/site/theme/template/Layout/index.jsx @@ -19,19 +19,6 @@ if (typeof window !== 'undefined' && navigator.serviceWorker) { }); } -window.addEventListener('error', function(e) { - // Ignore ResizeObserver error - if (e.message === 'ResizeObserver loop limit exceeded') { - e.stopPropagation(); - e.stopImmediatePropagation(); - } -}); - -if (process.env.NODE_ENV === 'production') { - LogRocket.init('kpuw4z/ant-design'); - setupLogRocketReact(LogRocket); -} - if (typeof window !== 'undefined') { /* eslint-disable global-require */ require('../../static/style'); @@ -41,6 +28,20 @@ if (typeof window !== 'undefined') { window['react-dom'] = ReactDOM; window.antd = require('antd'); /* eslint-enable global-require */ + + // Error log statistic + window.addEventListener('error', function(e) { + // Ignore ResizeObserver error + if (e.message === 'ResizeObserver loop limit exceeded') { + e.stopPropagation(); + e.stopImmediatePropagation(); + } + }); + + if (process.env.NODE_ENV === 'production') { + LogRocket.init('kpuw4z/ant-design'); + setupLogRocketReact(LogRocket); + } } let isMobile = false;