Skip to content

Commit 4fb3cb8

Browse files
committed
Better error message when package not deduped
1 parent a816822 commit 4fb3cb8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/useIsDark/client.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,15 @@ import { data_fr_scheme, data_fr_theme, rootColorSchemeStyleTagId } from "./cons
77
export type ColorScheme = "light" | "dark";
88

99
const $clientSideIsDark = createStatefulObservable<boolean>(() => {
10-
throw new Error("not initialized yet");
10+
throw new Error(
11+
[
12+
"react-dsfr not initialized",
13+
"Refer to the documentation for setup instructions",
14+
"If it used to work but after an update you're getting this error",
15+
"it usually means that you have multiple copies of @codegouvfr/react-dsfr in your node_modules",
16+
"@codegouvfr/react-dsfr is a singleton, try removing your lock file and node_module."
17+
].join(" ")
18+
);
1119
});
1220

1321
export type UseIsDark = () => {

0 commit comments

Comments
 (0)