fix(build): make transition tree-shakeable again

This commit is contained in:
Evan You 2020-07-20 16:13:41 -04:00
parent 6f148d0b9a
commit ad199e1a25
2 changed files with 10 additions and 4 deletions

View File

@ -55,7 +55,7 @@ const DOMTransitionPropsValidators = {
leaveToClass: String
}
export const TransitionPropsValidators = (Transition.props = extend(
export const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ extend(
{},
(BaseTransition as any).props,
DOMTransitionPropsValidators

View File

@ -39,7 +39,7 @@ export type TransitionGroupProps = Omit<TransitionProps, 'mode'> & {
const TransitionGroupImpl = {
name: 'TransitionGroup',
props: extend({}, TransitionPropsValidators, {
props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
tag: String,
moveClass: String
}),
@ -130,8 +130,14 @@ const TransitionGroupImpl = {
}
}
// remove mode props as TransitionGroup doesn't support it
delete TransitionGroupImpl.props.mode
/**
* TransitionGroup does not support "mode" so we need to remove it from the
* props declarations, but direct delete operation is considered a side effect
* and will make the entire transition feature non-tree-shakeable, so we do it
* in a function and mark the function's invocation as pure.
*/
const removeMode = (props: any) => delete props.mode
/*#__PURE__*/ removeMode(TransitionGroupImpl.props)
export const TransitionGroup = (TransitionGroupImpl as unknown) as {
new (): {