Skip to content
Source
Sign inSign up
TanStack/devtools
Open History to see the last commit

index.ts

19 lines700 Bytes

1import { EventClient as EventClientImpl } from './plugin'
2import { EventClientNoOp } from './noop'
3​
4/**
5 * The real `EventClient` in development; a no-op everywhere else.
6 *
7 * Production bundlers replace `process.env.NODE_ENV` with a literal, fold this
8 * ternary to `EventClientNoOp`, and tree-shake `./plugin` out of the bundle.
9 * To keep the real client in production, import it from
10 * `@tanstack/devtools-event-client/production` instead.
11 */
12const EventClient = (process.env.NODE_ENV !== 'development'
13 ? EventClientNoOp
14 : EventClientImpl) as unknown as typeof EventClientImpl
15​
16type EventClient<TEventMap extends Record<string, any>> =
17 EventClientImpl<TEventMap>
18​
19export { EventClient }