next-router-mock icon indicating copy to clipboard operation
next-router-mock copied to clipboard

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

Open highhi opened this issue 1 year ago • 2 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.

highhi avatar Nov 09 '23 04:11 highhi

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!

scottrippey avatar Nov 11 '23 03:11 scottrippey

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'

highhi avatar Nov 13 '23 05:11 highhi