From 55e2ce6269b00964cc9ed8841f6d37e5ef39fb02 Mon Sep 17 00:00:00 2001 From: afc163 Date: Tue, 26 Feb 2019 16:16:23 +0800 Subject: [PATCH] :wrench: Add logrocket https://logrocket.com/ --- package.json | 3 +++ site/bisheng.config.js | 2 ++ site/theme/template/Layout/index.jsx | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/package.json b/package.json index 96e66de256..2b5e2bedc4 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "antd-theme-generator": "^1.1.4", "antd-tools": "^7.0.1", "babel-eslint": "^10.0.1", + "babel-plugin-add-react-displayname": "^0.0.5", "bisheng": "^1.1.0", "bisheng-plugin-antd": "^1.0.0", "bisheng-plugin-description": "^0.1.4", @@ -138,6 +139,8 @@ "jsdom": "^13.0.0", "jsonml.js": "^0.1.0", "lint-staged": "^8.0.2", + "logrocket": "^0.6.19", + "logrocket-react": "^3.0.0", "lz-string": "^1.4.4", "majo": "^0.7.1", "mockdate": "^2.0.2", diff --git a/site/bisheng.config.js b/site/bisheng.config.js index 28dd3550c4..9cd84af61d 100644 --- a/site/bisheng.config.js +++ b/site/bisheng.config.js @@ -15,6 +15,8 @@ function alertBabelConfig(rules) { rule.options.plugins = rule.options.plugins.filter( plugin => !plugin.indexOf || plugin.indexOf('babel-plugin-add-module-exports') === -1, ); + // Add babel-plugin-add-react-displayname + rule.options.plugins.push(require.resolve('babel-plugin-add-react-displayname')); } else if (rule.use) { alertBabelConfig(rule.use); } diff --git a/site/theme/template/Layout/index.jsx b/site/theme/template/Layout/index.jsx index d1baa65e76..c10ff1ab34 100644 --- a/site/theme/template/Layout/index.jsx +++ b/site/theme/template/Layout/index.jsx @@ -5,6 +5,8 @@ import { enquireScreen } from 'enquire-js'; import { addLocaleData, IntlProvider } from 'react-intl'; import 'moment/locale/zh-cn'; import { LocaleProvider } from 'antd'; +import LogRocket from 'logrocket'; +import setupLogRocketReact from 'logrocket-react'; import zhCN from 'antd/lib/locale-provider/zh_CN'; import Header from './Header'; import enLocale from '../../en-US'; @@ -17,6 +19,9 @@ if (typeof window !== 'undefined' && navigator.serviceWorker) { }); } +LogRocket.init('kpuw4z/ant-design'); +setupLogRocketReact(LogRocket); + if (typeof window !== 'undefined') { /* eslint-disable global-require */ require('../../static/style');