scottrippey / next-router-mock

Mock implementation of the Next.js Router
MIT License
400 stars 38 forks source link

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

Open highhi opened 1 year ago

highhi commented 1 year ago
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.

scottrippey commented 1 year ago

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!

highhi commented 1 year ago

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'