diff --git a/hyperglass/ui/pages/_app.tsx b/hyperglass/ui/pages/_app.tsx index c817455..482afa5 100644 --- a/hyperglass/ui/pages/_app.tsx +++ b/hyperglass/ui/pages/_app.tsx @@ -1,18 +1,19 @@ import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { Meta, Layout } from '~/components'; -import { HyperglassProvider } from '~/context'; -import * as config from '../hyperglass.json'; - import type { AppProps } from 'next/app'; +import { Layout, Meta } from '~/components'; +import { HyperglassProvider } from '~/context'; import type { Config } from '~/types'; +// Declare imported JSON type to avoid type errors when file is not present (testing). +const config = (await import('../hyperglass.json')) as unknown as Config; + const queryClient = new QueryClient(); const App = (props: AppProps): JSX.Element => { const { Component, pageProps } = props; return ( - + diff --git a/hyperglass/ui/pages/_document.tsx b/hyperglass/ui/pages/_document.tsx index c1e12d2..09869d7 100644 --- a/hyperglass/ui/pages/_document.tsx +++ b/hyperglass/ui/pages/_document.tsx @@ -1,13 +1,15 @@ import fs from 'fs'; -import Document, { Html, Head, Main, NextScript } from 'next/document'; import { ColorModeScript } from '@chakra-ui/react'; -import { CustomJavascript, CustomHtml, Favicon } from '~/elements'; +import Document, { Html, Head, Main, NextScript } from 'next/document'; +import { CustomHtml, CustomJavascript, Favicon } from '~/elements'; import { googleFontUrl } from '~/util'; import favicons from '../favicon-formats'; -import config from '../hyperglass.json'; import type { DocumentContext, DocumentInitialProps } from 'next/document'; -import type { ThemeConfig } from '~/types'; +import type { Config, ThemeConfig } from '~/types'; + +// Declare imported JSON type to avoid type errors when file is not present (testing). +const config = (await import('../hyperglass.json')) as unknown as Config; interface DocumentExtra extends DocumentInitialProps,