feat: Partial migration to Next.js App Router and dependency updates #316
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit includes the initial steps of migrating the Hyper website from Next.js Pages Router to App Router, along with updating all dependencies to their latest versions.
Progress So Far:
Dependencies Updated:
next
to14.2.3
,@mdx-js/*
to3.1.0
,@next/mdx
to14.2.3
, and other development dependencies likehusky
andprettier
.Expected component Image to be defined
) by directly importingImage
andVideo
components intopages/blog/index.mdx
and removingMDXProvider
from thewithPost
HOC.react-highlighter
withreact-highlight-words
to resolve React 18 peer dependency issues.App Router Setup:
app
directory.app/layout.js
, including global styles, basic HTML structure, and a<main>
tag.pages/_app.js
(SearchContext, NProgress, gTagPageView) andpages/_document.js
(Google Analytics scripts) intoapp/layout.js
and a new client componentapp/components/navigation-events.js
.pages/_app.js
andpages/_document.js
.Page Migrations (Partial):
pages/index.js
) toapp/page.js
. This involved removinggetStaticProps
and marking the page as a client component due tostyled-jsx
anduseOs
hook. Several supporting components were also marked'use client'
.pages/blog/index.mdx
toapp/blog/page.mdx
. This has been challenging due to a persistent server-side build error:TypeError: r.createContext is not a function
(ors.createContext
).Troubleshooting Attempts for MDX/Blog Page:
next.config.js
uses the correct App Router setup for@next/mdx
.app/blog/layout.js
component instead of a Higher-Order Component wrapping MDX content directly.'use client'
where appropriate.jsxRuntime: 'classic'
option, but it's deprecated in MDX v3.MDXContext
withuseMDXComponents
, but our refactoring aimed to simplify component passing, bypassing explicitMDXProvider
oruseMDXComponents
in the page itself. The error seems to occur at a lower level in the MDX/Next.js server-side rendering pipeline.The build currently fails due to the MDX issue with
app/blog/page.mdx
. Further investigation is needed to resolve this specific MDX compilation/rendering error in the App Router.