You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FAIL cache/index.test.ts [ cache/index.test.ts ]
TypeError: cache is not a function
❯ cache/index.ts:9:50
and console.log(React.cache) gives you undefined.
Next.JS
nextjs actually loads react from node_modules/next/dist/compliled/next-server, for example in prod it's node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js.
Is there a way to let vitest load in this react version during the tests? Then can we not support next.js from that?
Suggested solution
I don't know. Somehow alias react to node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js.
Next.js 15 ships with React 19 available on userland, so this'll probably come soon.
Running flight server on Vitest is totally out of the scope at this point (though I have a proof of concept with Vite 6 hi-ogawa/vite-environment-examples#49). I don't think we have anything actionable for this issue, so let me close it for now.
Description
Currently when using Next 14, it can support features like React.cache.
For example, if my test is
You'll get hit with
and
console.log(React.cache)
gives you undefined.Next.JS
nextjs actually loads react from
node_modules/next/dist/compliled/next-server
, for example in prod it'snode_modules/next/dist/compiled/next-server/app-page.runtime.prod.js
.Is there a way to let vitest load in this react version during the tests? Then can we not support next.js from that?
Suggested solution
I don't know. Somehow alias react to
node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js
.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: