scottrippey / next-router-mock

Mock implementation of the Next.js Router

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

With Next14, the path to the RouterContext seems to be wrong.

highhi opened this issue · comments

  • Next 14.0.1
  • Node 18.18.1
  • next-router-mock 0.9.10
Module not found: Error: Can't resolve 'next/dist/shared/lib/router-context' in './node_modules/next-router-mock/dist/MemoryRouterProvider'

Perhaps next/dist/shared/lib/router-context.shared-runtime is the expected path.

You're correct, every couple of versions of Next, they move this file path.
I'll add next 14 support very soon. PR's welcome if you want to get to it sooner!

Thanks!I fixed the following in my application and the error went resolved.

- import { MemoryRouterProvider } from 'next-router-mock/MemoryRouterProvider'
+ import { MemoryRouterProvider } from 'next-router-mock/MemoryRouterProvider/next-13.5'