-
Heya! I'd love to use leva for non-prod builds for a debug menu but I haven't seen a way to be able to remove it from the bundle and change the hooks to just return the default value. Does this exist in any form today? |
Beta Was this translation helpful? Give feedback.
Answered by
itsdouges
Sep 26, 2022
Replies: 1 comment
-
I solved this by conditionally importing like so: import { useControls as useLevaControls } from 'leva';
export function useControls<Schema extends Record<string, any>>(
group: string,
schema: Schema
): Schema {
if (process.env.NODE_ENV !== 'production') {
// eslint-disable-next-line react-hooks/rules-of-hooks
return useLevaControls(group, schema) as Schema;
}
return schema;
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
itsdouges
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I solved this by conditionally importing like so: