Skip to content

Commit

Permalink
chore: use lodash-es to support vite (#2777)
Browse files Browse the repository at this point in the history
To fix error: `Uncaught (in promise) SyntaxError: The requested module
'/@modules/lodash/isPlainObject.js' does not provide an export named
'default'`
  • Loading branch information
CarterLi authored Sep 2, 2020
1 parent 58b66da commit fb52b36
Show file tree
Hide file tree
Showing 27 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion components/_util/moment-util.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import interopDefault from './interopDefault';
import moment from 'moment';
import warning from './warning';
import isNil from 'lodash/isNil';
import isNil from 'lodash-es/isNil';

export const TimeType = {
validator(value) {
Expand Down
2 changes: 1 addition & 1 deletion components/_util/props-util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isPlainObject from 'lodash/isPlainObject';
import isPlainObject from 'lodash-es/isPlainObject';
import classNames from './classNames';
import { isVNode, Fragment, Comment, Text, h } from 'vue';
import { camelize, hyphenate, isOn, resolvePropValue } from './util';
Expand Down
2 changes: 1 addition & 1 deletion components/_util/vue-types/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isPlainObject from 'lodash/isPlainObject';
import isPlainObject from 'lodash-es/isPlainObject';
import { toType, getType, isFunction, validateType, isInteger, isArray, warn } from './utils';

const VuePropTypes = {
Expand Down
2 changes: 1 addition & 1 deletion components/_util/vue-types/utils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import isPlainObject from 'lodash/isPlainObject';
import isPlainObject from 'lodash-es/isPlainObject';

const ObjProto = Object.prototype;
const toString = ObjProto.toString;
Expand Down
2 changes: 1 addition & 1 deletion components/card/Card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import PropTypes from '../_util/vue-types';
import { getComponent, getSlot, isEmptyElement } from '../_util/props-util';
import BaseMixin from '../_util/BaseMixin';
import { ConfigConsumerProps } from '../config-provider';
import isPlainObject from 'lodash/isPlainObject';
import isPlainObject from 'lodash-es/isPlainObject';

const { TabPane } = Tabs;
export default {
Expand Down
2 changes: 1 addition & 1 deletion components/carousel/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject } from 'vue';
import PropTypes from '../_util/vue-types';
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';
import hasProp, { initDefaultProps, getComponent } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import warning from '../_util/warning';
Expand Down
2 changes: 1 addition & 1 deletion components/color-picker/ColorPicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Pickr from '@simonwep/pickr/dist/pickr.es5.min';
import Icon from '../icon';
import LocaleReceiver from '../locale-provider/LocaleReceiver';
import enUS from './locale/en_US';
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';

import { getOptionProps, findDOMNode } from '../_util/props-util';
let colors = '#194d33';
Expand Down
2 changes: 1 addition & 1 deletion components/date-picker/createPicker.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject } from 'vue';
import moment from 'moment';
import omit from 'lodash/omit';
import omit from 'lodash-es/omit';
import MonthCalendar from '../vc-calendar/src/MonthCalendar';
import VcDatePicker from '../vc-calendar/src/Picker';
import classNames from '../_util/classNames';
Expand Down
4 changes: 2 additions & 2 deletions components/form/Form.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { inject, provide } from 'vue';
import PropTypes from '../_util/vue-types';
import classNames from '../_util/classNames';
import { ColProps } from '../grid/Col';
import isRegExp from 'lodash/isRegExp';
import isRegExp from 'lodash-es/isRegExp';
import warning from '../_util/warning';
import FormItem from './FormItem';
import { initDefaultProps, getSlot } from '../_util/props-util';
Expand All @@ -11,7 +11,7 @@ import { getNamePath, containsNamePath } from './utils/valueUtil';
import { defaultValidateMessages } from './utils/messages';
import { allPromiseFinish } from './utils/asyncUtil';
import { toArray } from './utils/typeUtil';
import isEqual from 'lodash/isEqual';
import isEqual from 'lodash-es/isEqual';
import scrollIntoView from 'scroll-into-view-if-needed';

export const FormProps = {
Expand Down
4 changes: 2 additions & 2 deletions components/form/FormItem.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, provide, Transition } from 'vue';
import cloneDeep from 'lodash/cloneDeep';
import cloneDeep from 'lodash-es/cloneDeep';
import PropTypes from '../_util/vue-types';
import classNames from '../_util/classNames';
import getTransitionProps from '../_util/getTransitionProps';
Expand All @@ -25,7 +25,7 @@ import { validateRules } from './utils/validateUtil';
import { getNamePath } from './utils/valueUtil';
import { toArray } from './utils/typeUtil';
import { warning } from '../vc-util/warning';
import find from 'lodash/find';
import find from 'lodash-es/find';

const iconMap = {
success: CheckCircleFilled,
Expand Down
2 changes: 1 addition & 1 deletion components/input/Search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { cloneElement } from '../_util/vnode';
import PropTypes from '../_util/vue-types';
import { getOptionProps, getComponent } from '../_util/props-util';
import { ConfigConsumerProps } from '../config-provider';
import isPlainObject from 'lodash/isPlainObject';
import isPlainObject from 'lodash-es/isPlainObject';

export default {
name: 'AInputSearch',
Expand Down
2 changes: 1 addition & 1 deletion components/spin/Spin.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { inject, cloneVNode, isVNode } from 'vue';
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';
import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin';
import { initDefaultProps, getComponent, getSlot } from '../_util/props-util';
Expand Down
2 changes: 1 addition & 1 deletion components/statistic/Number.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import padEnd from 'lodash/padEnd';
import padEnd from 'lodash-es/padEnd';
import { createVNode } from 'vue';

const Number = (_, { attrs }) => {
Expand Down
2 changes: 1 addition & 1 deletion components/statistic/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import moment from 'moment';
import padStart from 'lodash/padStart';
import padStart from 'lodash-es/padStart';

import interopDefault from '../_util/interopDefault';

Expand Down
2 changes: 1 addition & 1 deletion components/tree/DirectoryTree.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject } from 'vue';
import omit from 'omit.js';
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';
import FolderOpenOutlined from '@ant-design/icons-vue/FolderOpenOutlined';
import FolderOutlined from '@ant-design/icons-vue/FolderOutlined';
import FileOutlined from '@ant-design/icons-vue/FileOutlined';
Expand Down
4 changes: 2 additions & 2 deletions components/upload/Upload.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import classNames from '../_util/classNames';
import uniqBy from 'lodash/uniqBy';
import findIndex from 'lodash/findIndex';
import uniqBy from 'lodash-es/uniqBy';
import findIndex from 'lodash-es/findIndex';
import VcUpload from '../vc-upload';
import BaseMixin from '../_util/BaseMixin';
import { getOptionProps, initDefaultProps, hasProp, getSlot } from '../_util/props-util';
Expand Down
2 changes: 1 addition & 1 deletion components/vc-align/Align.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { alignElement, alignPoint } from 'dom-align';
import addEventListener from '../vc-util/Dom/addEventListener';
import { isWindow, buffer, isSamePoint, isSimilarValue, restoreFocus } from './util';
import { cloneElement } from '../_util/vnode.js';
import clonedeep from 'lodash/cloneDeep';
import clonedeep from 'lodash-es/cloneDeep';
import { getSlot, findDOMNode } from '../_util/props-util';

function getElement(func) {
Expand Down
2 changes: 1 addition & 1 deletion components/vc-calendar/src/Picker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import KeyCode from '../../_util/KeyCode';
import placements from './picker/placements';
import Trigger from '../../vc-trigger';
import moment from 'moment';
import isNil from 'lodash/isNil';
import isNil from 'lodash-es/isNil';
const TimeType = {
validator(value) {
if (Array.isArray(value)) {
Expand Down
4 changes: 2 additions & 2 deletions components/vc-lazy-load/src/LazyLoad.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import BaseMixin from '../../_util/BaseMixin';
import addEventListener from '../../vc-util/Dom/addEventListener';
import { initDefaultProps, findDOMNode, getSlot } from '../../_util/props-util';
import warning from '../../_util/warning';
import debounce from 'lodash/debounce';
import throttle from 'lodash/throttle';
import debounce from 'lodash-es/debounce';
import throttle from 'lodash-es/throttle';
import parentScroll from './utils/parentScroll';
import inViewport from './utils/inViewport';
import { watchEffect } from 'vue';
Expand Down
2 changes: 1 addition & 1 deletion components/vc-menu/util.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import isMobile from './utils/isMobile';
import isObject from 'lodash/isObject';
import isObject from 'lodash-es/isObject';

export function noop() {}

Expand Down
2 changes: 1 addition & 1 deletion components/vc-slick/src/inner-slider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';
import classnames from '../../_util/classNames';
import BaseMixin from '../../_util/BaseMixin';
import defaultProps from './default-props';
Expand Down
2 changes: 1 addition & 1 deletion components/vc-steps/Steps.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from '../_util/vue-types';
import BaseMixin from '../_util/BaseMixin';
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';
import isFlexSupported from '../_util/isFlexSupported';
import { filterEmpty, getSlot, getPropsData } from '../_util/props-util';
import { cloneElement } from '../_util/vnode';
Expand Down
2 changes: 1 addition & 1 deletion components/vc-table/src/Table.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable camelcase */
import { provide, markRaw } from 'vue';
import shallowequal from '../../_util/shallowequal';
import merge from 'lodash/merge';
import merge from 'lodash-es/merge';
import classes from 'component-classes';
import classNames from '../../_util/classNames';
import PropTypes from '../../_util/vue-types';
Expand Down
2 changes: 1 addition & 1 deletion components/vc-table/src/TableCell.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { inject } from 'vue';
import PropTypes from '../../_util/vue-types';
import get from 'lodash/get';
import get from 'lodash-es/get';
import classNames from '../../_util/classNames';
import { isValidElement } from '../../_util/props-util';

Expand Down
2 changes: 1 addition & 1 deletion components/vc-tabs/src/ScrollableTabBarNode.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import debounce from 'lodash/debounce';
import debounce from 'lodash-es/debounce';
import ResizeObserver from 'resize-observer-polyfill';
import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
Expand Down
2 changes: 1 addition & 1 deletion components/vc-upload/src/AjaxUploader.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import PropTypes from '../../_util/vue-types';
import BaseMixin from '../../_util/BaseMixin';
import partition from 'lodash/partition';
import partition from 'lodash-es/partition';
import classNames from '../../_util/classNames';
import defaultRequest from './request';
import getUid from './uid';
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@
},
"homepage": "https://www.antdv.com/",
"peerDependencies": {
"vue": ">=3.0.0",
"@vue/compiler-sfc": ">=3.0.0"
"@vue/compiler-sfc": ">=3.0.0",
"vue": ">=3.0.0"
},
"devDependencies": {
"@ant-design-vue/babel-plugin-jsx": "^1.0.0-rc.1",
Expand Down Expand Up @@ -200,7 +200,7 @@
"is-negative-zero": "^2.0.0",
"ismobilejs": "^1.0.0",
"json2mq": "^0.2.0",
"lodash": "^4.17.5",
"lodash-es": "^4.17.15",
"moment": "^2.27.0",
"node-emoji": "^1.10.0",
"omit.js": "^2.0.0",
Expand Down

0 comments on commit fb52b36

Please sign in to comment.