Skip to content

Commit ad199e1

Browse files
committed
fix(build): make transition tree-shakeable again
1 parent 6f148d0 commit ad199e1

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

packages/runtime-dom/src/components/Transition.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const DOMTransitionPropsValidators = {
5555
leaveToClass: String
5656
}
5757

58-
export const TransitionPropsValidators = (Transition.props = extend(
58+
export const TransitionPropsValidators = (Transition.props = /*#__PURE__*/ extend(
5959
{},
6060
(BaseTransition as any).props,
6161
DOMTransitionPropsValidators

packages/runtime-dom/src/components/TransitionGroup.ts

+9-3
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export type TransitionGroupProps = Omit<TransitionProps, 'mode'> & {
3939
const TransitionGroupImpl = {
4040
name: 'TransitionGroup',
4141

42-
props: extend({}, TransitionPropsValidators, {
42+
props: /*#__PURE__*/ extend({}, TransitionPropsValidators, {
4343
tag: String,
4444
moveClass: String
4545
}),
@@ -130,8 +130,14 @@ const TransitionGroupImpl = {
130130
}
131131
}
132132

133-
// remove mode props as TransitionGroup doesn't support it
134-
delete TransitionGroupImpl.props.mode
133+
/**
134+
* TransitionGroup does not support "mode" so we need to remove it from the
135+
* props declarations, but direct delete operation is considered a side effect
136+
* and will make the entire transition feature non-tree-shakeable, so we do it
137+
* in a function and mark the function's invocation as pure.
138+
*/
139+
const removeMode = (props: any) => delete props.mode
140+
/*#__PURE__*/ removeMode(TransitionGroupImpl.props)
135141

136142
export const TransitionGroup = (TransitionGroupImpl as unknown) as {
137143
new (): {

0 commit comments

Comments
 (0)