Closed freirepaulo closed 3 weeks ago
Hi, please set up a public repo or a CodeSandbox project with a minimal reproduction of the issue so I can investigate the problem, thanks.
@TheEdoRan https://github.com/freirepaulo/next-safe-action public repo that has the issue - to reproduce is just checkout on the main branch > run yarn > yarn test
If I change all the imports and exports in the hook.mjs and index.mjs resolves the problem, but I don't know what will impact the library structure....
Thank you for providing the repro. I solved the issue on my end by setting this option in next.config.mjs
:
const nextConfig = {
+ transpilePackages: ["next-safe-action"],
};
Vitest should be a better testing framework though, if you can switch to it. Let me know if setting that option fixes the issue for you as well, thanks!
Are you using the latest version of this library?
Is there an existing issue for this?
Describe the bug
First of all, I would like to thank you for the excellent work you have been doing with this library. However, I am facing an issue in my new project.
When I try to run my tests (just a simple test), it returns this error within the dist of safe-action. I noticed that a similar issue was opened in the past and resolved, but the problem seems to have returned:
These are the dependencies I am using:
Reproduction steps
is also important to say that the page.tsx is a server component and the SearchArea.tsx is a client component.
this the unit test that is breaking:
Expected behavior
the test should pass
Minimal reproduction example
private repo
Operating System
macOS
Library version
7.8.0
Next.js version
14.2.5
Node.js version
21.7.3
Additional context
No response