build: avoid exporting setDevTools in global prod build

This commit is contained in:
Evan You 2023-12-26 11:03:45 +08:00
parent b4ebe7ae8b
commit ee68c525f0
2 changed files with 14 additions and 2 deletions

View File

@ -21,7 +21,7 @@ enum DevtoolsHooks {
PERFORMANCE_END = 'perf:end' PERFORMANCE_END = 'perf:end'
} }
interface DevtoolsHook { export interface DevtoolsHook {
enabled?: boolean enabled?: boolean
emit: (event: string, ...payload: any[]) => void emit: (event: string, ...payload: any[]) => void
on: (event: string, handler: Function) => void on: (event: string, handler: Function) => void

View File

@ -150,7 +150,18 @@ export const ErrorTypeStrings = (
) as typeof _ErrorTypeStrings ) as typeof _ErrorTypeStrings
// For devtools // For devtools
export { devtools, setDevtoolsHook } from './devtools' import {
devtools as _devtools,
setDevtoolsHook as _setDevtoolsHook,
DevtoolsHook
} from './devtools'
export const devtools = (
__DEV__ || __FEATURE_PROD_DEVTOOLS__ ? _devtools : undefined
) as DevtoolsHook
export const setDevtoolsHook = (
__DEV__ || __FEATURE_PROD_DEVTOOLS__ ? _setDevtoolsHook : NOOP
) as typeof _setDevtoolsHook
// Types ------------------------------------------------------------------------- // Types -------------------------------------------------------------------------
@ -377,6 +388,7 @@ import {
softAssertCompatEnabled softAssertCompatEnabled
} from './compat/compatConfig' } from './compat/compatConfig'
import { resolveFilter as _resolveFilter } from './helpers/resolveAssets' import { resolveFilter as _resolveFilter } from './helpers/resolveAssets'
import { NOOP } from '@vue/shared'
/** /**
* @internal only exposed in compat builds * @internal only exposed in compat builds