Skip to content

Commit

Permalink
fix(build): retain defineComponent() treeshakability in Rollup
Browse files Browse the repository at this point in the history
close #8236
  • Loading branch information
yyx990803 committed May 8, 2023
1 parent b2be75b commit c2172f3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/runtime-core/src/apiDefineComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,9 @@ export function defineComponent(
extraOptions?: ComponentOptions
) {
return isFunction(options)
? extend({ name: options.name }, extraOptions, { setup: options })
? // #8326: extend call and options.name access are considered side-effects
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
/*#__PURE__*/ (() =>
extend({ name: options.name }, extraOptions, { setup: options }))()
: options
}

0 comments on commit c2172f3

Please sign in to comment.