mirror of https://github.com/vuejs/core.git
fix(build): retain defineComponent() treeshakability in Rollup
close #8236
This commit is contained in:
parent
b2be75bad4
commit
c2172f3a0e
|
@ -279,6 +279,9 @@ export function defineComponent(
|
||||||
extraOptions?: ComponentOptions
|
extraOptions?: ComponentOptions
|
||||||
) {
|
) {
|
||||||
return isFunction(options)
|
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
|
: options
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue