Comments (3)
OMG, I just found out it works IF you properly import MemoryRouterProvider
import { MemoryRouterProvider } from 'next-router-mock/MemoryRouterProvider/next-13';
That /next-13
part in the end was essential.
Either I missed this in the documentation, or the documentation could be improved.
from next-router-mock.
Could you help me find the problem?
The 'next-router-mock/MemoryRouterProvider'
path just tries to import next-13
and if it fails, next-12
and so on until it succeeds.
I'm thinking that this probably doesn't work with Storybook's webpack, since it will try to compile all imported modules, and can't find the legacy ones? Could you post the error you were seeing?
If so, the docs definitely need updating!
from next-router-mock.
Hey, sure thing I could help.
Here's the text of that error
ModuleNotFoundError: Module not found: Error: Can't resolve 'next/dist/next-server/lib/router-context' in 'Q:\Dev\fe\node_modules\next-router-mock\dist\MemoryRouterProvider'
from next-router-mock.
Related Issues (20)
- MemoryRouterProvider/index.d.ts' is not a module. HOT 4
- Failed to install due to `postinstall` script on v0.7.3 HOT 2
- Issue with next/link in Next >12.2.0, 13.* HOT 15
- Failed to jest example code on Readme in Next12.1.6 HOT 2
- Cannot use default (singleton) router: "You should only use "next/router" on the client side of your app" HOT 21
- Router.push "as" parameter not working HOT 1
- feat request: drop support for nextjs 10.x HOT 1
- Support Next 13 'next/navigation' router HOT 17
- Question: Nested component that has `useRouter` tests are taking much longer HOT 3
- Mock router doesn't update with `userEvent` HOT 2
- Modify the as param condition HOT 2
- configuring webpack alias in storybook, it doesn't to work in storybook test HOT 9
- `router.back` support HOT 4
- Add a changelog HOT 2
- In 0.9.3 test asserting `window.location.assign` fails HOT 1
- Is it possible to use dynamic routes with the MemoryRouterProvider for rendering in storybook? HOT 3
- dist folder auto-import inconsistencies HOT 2
- Using `next/link` with the locale property. HOT 1
- How to mock next router with jest `experimental-vm-modules` HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-router-mock.