Support Dynamic Routes with Next v12 (Cannot find module 'next/dist/server/normalize-page-path')
See original GitHub issuehello, i have this error :
Test suite failed to run
Cannot find module 'next/dist/server/normalize-page-path' from 'node_modules/next-router-mock/dist/dynamic-routes/extensions-11.1.js'
Require stack:
node_modules/next-router-mock/dist/dynamic-routes/extensions-11.1.js
components/Breadcrumb/__tests__/BreadcrumbActu.test.js
at Resolver._throwModNotFoundError (node_modules/jest-resolve/build/resolver.js:491:11)
at Object.<anonymous> (node_modules/next-router-mock/src/dynamic-routes/extensions-11.1.ts:9:1)
My version of next.js : “12.1.6”
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Error: Cannot find module 'next/dist/shared/lib/router/utils ...
OK - I was able to fix this issue by deleting ~/.next. Seems like a build cache bug. Latest version removed routing-items.js but...
Read more >Nextjs export gives Cannot find module for page
I wanted to export the site with some dynamic routes. My pages folder structure is like below page locales [locale] [slug].js. When I...
Read more >Advanced Features: Next.js Compiler
Learn about the Next.js Compiler, written in Rust, which transforms and minifies your Next.js application.
Read more >next-connect - npm
The method routing and middleware layer for Next.js (and many others). ... It does not support error-handling middleware pattern.
Read more >About Dynamic Routing - WatchGuard Technologies
With static routing, routing tables are set and do not change. If a router on the remote path fails, a packet cannot get...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I published this as a prerelease! Can you test this out, and lmk if it works?
Version
0.6.8-next12.0
As @scottrippey correctly spotted, this file has been moved to the other path in the v12. The provided temporary workaround is almost fine and we have to mark this mock as a
virtual
like below:The jest docs about this argument: https://jestjs.io/docs/jest-object#jestmockmodulename-factory-options