From a6b3dba92e7c3a1275d78eae565831165391211e Mon Sep 17 00:00:00 2001 From: Baorong Li Date: Fri, 13 Apr 2018 18:19:22 +0800 Subject: [PATCH] cut moment locale/lodash size & revert d06ee20 --- .webpackrc.js | 1 + package.json | 6 +++++- src/components/DataTable/DataTable.js | 7 ++++--- src/pages/chart/highCharts/HighMoreComponent.js | 7 +++++-- src/utils/index.js | 4 ++-- src/utils/request.js | 4 ++-- 6 files changed, 19 insertions(+), 10 deletions(-) diff --git a/.webpackrc.js b/.webpackrc.js index 552ae20..57c899f 100644 --- a/.webpackrc.js +++ b/.webpackrc.js @@ -21,4 +21,5 @@ export default { urlLoaderExcludes: [ /\.svg$/, ], + ignoreMomentLocale: true, } diff --git a/package.json b/package.json index bd58a6a..6047964 100644 --- a/package.json +++ b/package.json @@ -14,8 +14,11 @@ "echarts-for-react": "^2.0.8", "echarts-gl": "^1.1.0", "echarts-liquidfill": "^2.0.0", + "highcharts-exporting": "^0.1.7", + "highcharts-more": "^0.1.7", "jsonp": "^0.2.1", - "lodash": "^4.17.5", + "lodash.clonedeep": "^4.5.0", + "lodash.isequal": "^4.5.0", "nprogress": "^0.2.0", "path-to-regexp": "^2.2.0", "prop-types": "^15.6.1", @@ -52,6 +55,7 @@ "lint" ], "scripts": { + "analyze": "cross-env ANALYZE=1 BABELRC=1 umi build", "start": "cross-env BABELRC=1 COMPILE_ON_DEMAND=none BROWSER=none HOST=0.0.0.0 umi dev", "lint": "eslint --fix --ext .js src", "build": "cross-env BABELRC=1 umi build", diff --git a/src/components/DataTable/DataTable.js b/src/components/DataTable/DataTable.js index 4b33461..8f5417c 100644 --- a/src/components/DataTable/DataTable.js +++ b/src/components/DataTable/DataTable.js @@ -2,7 +2,8 @@ import React from 'react' import PropTypes from 'prop-types' import { Table } from 'antd' import { request } from 'utils' -import lodash from 'lodash' +import cloneDeep from 'lodash.clonedeep' +import isEqual from 'lodash.isequal' import './DataTable.less' class DataTable extends React.Component { @@ -32,11 +33,11 @@ class DataTable extends React.Component { } componentWillReceiveProps (nextProps) { - const staticNextProps = lodash.cloneDeep(nextProps) + const staticNextProps = cloneDeep(nextProps) delete staticNextProps.columns const { columns, ...otherProps } = this.props - if (!lodash.isEqual(staticNextProps, otherProps)) { + if (!isEqual(staticNextProps, otherProps)) { this.props = nextProps this.fetch() } diff --git a/src/pages/chart/highCharts/HighMoreComponent.js b/src/pages/chart/highCharts/HighMoreComponent.js index f207057..2f310d4 100644 --- a/src/pages/chart/highCharts/HighMoreComponent.js +++ b/src/pages/chart/highCharts/HighMoreComponent.js @@ -1,8 +1,11 @@ import React from 'react' import ReactHighcharts from 'react-highcharts' +import HighchartsExporting from 'highcharts-exporting' +import HighchartsMore from 'highcharts-more' -require ('highcharts-more')(ReactHighcharts.Highcharts) -require ('highcharts-exporting')(ReactHighcharts.Highcharts) + +HighchartsMore(ReactHighcharts.Highcharts) +HighchartsExporting(ReactHighcharts.Highcharts) const config = { chart: { diff --git a/src/utils/index.js b/src/utils/index.js index ac4e4cd..e5c8383 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -1,5 +1,5 @@ /* global window */ -import lodash from 'lodash' +import cloneDeep from 'lodash.clonedeep' export classnames from 'classnames' export config from './config' @@ -80,7 +80,7 @@ export function queryArray (array, key, keyAlias = 'key') { * @return {Array} */ export function arrayToTree (array, id = 'id', pid = 'pid', children = 'children') { - let data = lodash.cloneDeep(array) + let data = cloneDeep(array) let result = [] let hash = {} data.forEach((item, index) => { diff --git a/src/utils/request.js b/src/utils/request.js index 31c2a5f..c084688 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -2,7 +2,7 @@ import axios from 'axios' import qs from 'qs' import jsonp from 'jsonp' -import lodash from 'lodash' +import cloneDeep from 'lodash.clonedeep' import pathToRegexp from 'path-to-regexp' import { message } from 'antd' import { YQL, CORS } from './config' @@ -15,7 +15,7 @@ const fetch = (options) => { url, } = options - const cloneData = lodash.cloneDeep(data) + const cloneData = cloneDeep(data) try { let domin = ''