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 11 months ago

highhi commented 11 months 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 11 months 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 10 months 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'