build: further shave off runtime compile only code
This commit is contained in:
@@ -320,7 +320,7 @@ function finishComponentSetup(
|
||||
) {
|
||||
const Component = instance.type as ComponentOptions
|
||||
if (!instance.render) {
|
||||
if (Component.template && !Component.render) {
|
||||
if (__RUNTIME_COMPILE__ && Component.template && !Component.render) {
|
||||
if (compile) {
|
||||
Component.render = compile(Component.template, {
|
||||
onError(err: CompilerError) {
|
||||
|
||||
@@ -48,7 +48,7 @@ const publicPropertiesMap = {
|
||||
$options: 'type'
|
||||
}
|
||||
|
||||
export const PublicInstanceProxyHandlers = {
|
||||
export const PublicInstanceProxyHandlers: ProxyHandler<any> = {
|
||||
get(target: ComponentInternalInstance, key: string) {
|
||||
const { renderContext, data, props, propsProxy } = target
|
||||
if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
||||
@@ -76,11 +76,7 @@ export const PublicInstanceProxyHandlers = {
|
||||
}
|
||||
return target.user[key]
|
||||
},
|
||||
// this trap is only called in browser-compiled render functions that use
|
||||
// `with (this) {}`
|
||||
has(_: any, key: string): boolean {
|
||||
return key[0] !== '_' && !globalsWhitelist.has(key)
|
||||
},
|
||||
|
||||
set(target: ComponentInternalInstance, key: string, value: any): boolean {
|
||||
const { data, renderContext } = target
|
||||
if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
||||
@@ -105,3 +101,11 @@ export const PublicInstanceProxyHandlers = {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
if (__RUNTIME_COMPILE__) {
|
||||
// this trap is only called in browser-compiled render functions that use
|
||||
// `with (this) {}`
|
||||
PublicInstanceProxyHandlers.has = (_: any, key: string): boolean => {
|
||||
return key[0] !== '_' && !globalsWhitelist.has(key)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user