Skip to content

Commit c2172f3

Browse files
committed
fix(build): retain defineComponent() treeshakability in Rollup
close #8236
1 parent b2be75b commit c2172f3

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/runtime-core/src/apiDefineComponent.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ export function defineComponent(
279279
extraOptions?: ComponentOptions
280280
) {
281281
return isFunction(options)
282-
? extend({ name: options.name }, extraOptions, { setup: options })
282+
? // #8326: extend call and options.name access are considered side-effects
283+
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
284+
/*#__PURE__*/ (() =>
285+
extend({ name: options.name }, extraOptions, { setup: options }))()
283286
: options
284287
}

0 commit comments

Comments
 (0)