diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-26 12:21:58 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-26 12:21:58 +0100 |
| commit | 1ecc8089dd1f90ee20064cfda39855fc8805e9cf (patch) | |
| tree | 0a071ef2bccf65ac639330727ad7219e70e04628 /src/pages | |
| parent | 4aedfb4f57a55f39909b96ce86493daa39f3b9f0 (diff) | |
fix: replace dynamic import with require
The table of contents was not able to get the headings list on first
render because of dynamic import. By using require, it works as
expected.
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/projet/[slug].tsx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/pages/projet/[slug].tsx b/src/pages/projet/[slug].tsx index 0f3aea9..a9b5115 100644 --- a/src/pages/projet/[slug].tsx +++ b/src/pages/projet/[slug].tsx @@ -15,11 +15,12 @@ import { getAllProjectsFilename, getProjectData, } from '@utils/helpers/projects'; +import { MDXComponents } from 'mdx/types'; import { GetStaticPaths, GetStaticProps, GetStaticPropsContext } from 'next'; -import dynamic from 'next/dynamic'; import Head from 'next/head'; import { useRouter } from 'next/router'; import { ParsedUrlQuery } from 'querystring'; +import { ComponentType } from 'react'; import { Article, Graph, WebPage } from 'schema-dts'; const Project: NextPageWithLayout<ProjectProps> = ({ @@ -35,9 +36,8 @@ const Project: NextPageWithLayout<ProjectProps> = ({ update: meta.updatedOn, }; - const ProjectContent = dynamic( - () => import(`../../content/projects/${id}.mdx`) - ); + const ProjectContent: ComponentType<MDXComponents> = + require(`../../content/projects/${id}.mdx`).default; const webpageSchema: WebPage = { '@id': `${projectUrl}`, |
