Skip to content

Commit 21eb04f

Browse files
committed
πŸ§‘β€πŸ’»(frontend) add debug flags
Debug flags can be used to toggle debugging in various environments and situations. - They need to be explicitly enabled. - This commit enables them for development. - They can help investigate bugs in production environments, - They can change the behavior of the app and add additional info when developing, improving the DX. Signed-off-by: Robin Weber <[email protected]>
1 parent 9756fa7 commit 21eb04f

File tree

1 file changed

+14
-0
lines changed
  • src/frontend/apps/impress/src/pages

1 file changed

+14
-0
lines changed

β€Žsrc/frontend/apps/impress/src/pages/_app.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import debug from 'debug';
12
import type { AppProps } from 'next/app';
23
import Head from 'next/head';
34
import { useTranslation } from 'react-i18next';
@@ -18,6 +19,19 @@ export default function App({ Component, pageProps }: AppPropsWithLayout) {
1819
const getLayout = Component.getLayout ?? ((page) => page);
1920
const { t } = useTranslation();
2021

22+
if (process.env.NODE_ENV === 'development') {
23+
/**
24+
* Add and enable new debug namespaces as needed
25+
*
26+
* They can also be enabled via DEBUG environment variable
27+
* Example: DEBUG=features:language,no-cache
28+
*
29+
* They can also be enabled in the browser console
30+
* Example: window.debug = 'features:language,no-cache';
31+
*/
32+
debug.enable(['no-cache', 'features:language'].join(','));
33+
}
34+
2135
return (
2236
<>
2337
<Head>

0 commit comments

Comments
Β (0)