See MSWjs and NextJS with Instrumentation feature in a real open source project github.com/EddieHubCommunity/HealthCheck
@fransjoakimtitulaer24043 ай бұрын
Thank you! It's been hard finding good resources covering this
@eddiejaoude3 ай бұрын
yes I found it difficult when researching also. Thank you for the great feedback. I have a blog version also if you need for reference
@kakseigrae2 ай бұрын
Super helpful, thank you! For the morons like me who rush to use Next 15, you must not add the experimental object as it's no longer experimental feature and you must put the instrumentarium file in the root of your project (not ./app), where package.json lives. Cheers!
@eddiejaoude2 ай бұрын
Thanks for the great feedback! Ah yes, the new version doesn't require the extra config. Thanks for the reminder
@harshitpant1743Ай бұрын
This is super helpful @kakseigrae , I am using 15 as well. But the import {setupServer} from 'msw/node' is not working, Also 'msw/browser' does not work for me . Do you know the reason for this?
@jayraldempino19444 ай бұрын
I use mswjs in client side which sooo good. In terms of the mock data, fakerjs is also better with it. Thanks for this, man! Thumbs up for this tutorial.
@eddiejaoude4 ай бұрын
Thank you for the great feedback!!
@euanmorgann20 күн бұрын
Have you managed to get this working with recent versions of msw? For me any version greater than 2.4.3 is completely broken
@eddiejaoude20 күн бұрын
I have not tried yet, i will try soon on my new project and latest versions.
@johnaroj7 күн бұрын
for serveractions you just mock it with /api/route and use a POST or there is another way to write functions?
@eddiejaoude7 күн бұрын
if you mock a function it is more of a unit test, by mocking external api calls, you are doing more of an end to end test
@dartess3 ай бұрын
Unfortunately this doesn't work in build time, only in dev time.
@euanmorgann20 күн бұрын
It's not really intended for build time it's meant for tests / local dev
@eddiejaoude20 күн бұрын
yep 👍
@minhazulabedin96034 ай бұрын
I always get the error: Package path ./browser is not exported from package
@eddiejaoude4 ай бұрын
i am not using the browserfile, i am using the node file. what are you trying to do?
@JibbaJabber4 ай бұрын
#Noice
@eddiejaoude4 ай бұрын
thank you
@negarmir3334Ай бұрын
Hi @eddiejaoude I am using the nextjs15 with mswjs 2.6.8. I just added the instrumentation.ts in the root of app next to package.json but it is not working. Do you have any idea how to fix it?
@eddiejaoude20 күн бұрын
it is unclear what is not working in your project, let's start at the beginning, does your instrumentation file trigger?