Skip to content

Commit

Permalink
build: avoid exporting setDevTools in global prod build
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Dec 26, 2023
1 parent b4ebe7a commit ee68c52
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/runtime-core/src/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ enum DevtoolsHooks {
PERFORMANCE_END = 'perf:end'
}

interface DevtoolsHook {
export interface DevtoolsHook {
enabled?: boolean
emit: (event: string, ...payload: any[]) => void
on: (event: string, handler: Function) => void
Expand Down
14 changes: 13 additions & 1 deletion packages/runtime-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,18 @@ export const ErrorTypeStrings = (
) as typeof _ErrorTypeStrings

// 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 -------------------------------------------------------------------------

Expand Down Expand Up @@ -377,6 +388,7 @@ import {
softAssertCompatEnabled
} from './compat/compatConfig'
import { resolveFilter as _resolveFilter } from './helpers/resolveAssets'
import { NOOP } from '@vue/shared'

/**
* @internal only exposed in compat builds
Expand Down

0 comments on commit ee68c52

Please sign in to comment.