-
-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Building elysia v1.2.2 via next build
crashes with "Can't resolve 'fs'"
#971
Comments
having the same issue using as nextjs adapter only with nodejs |
Should have been fixed in e83daaf, published under 1.2.3 Let me know if the issue still persists after updating to 1.2.3. If so, please provide a simple reproducible repo, thanks. |
its still happening [zero@arch next-elysia-prisma]$ bun run build
$ next build
▲ Next.js 15.1.2
- Environments: .env
Creating an optimized production build ...
Failed to compile.
./node_modules/elysia/dist/universal/file.mjs
Module not found: Can't resolve 'fs'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/elysia/dist/index.mjs
./src/lib/typebox/auth.ts
./src/app/(auth)/login/page.tsx
./node_modules/elysia/dist/universal/file.mjs
Module not found: Can't resolve 'fs/promises'
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module:
./node_modules/elysia/dist/index.mjs
./src/lib/typebox/auth.ts
./src/app/(auth)/login/page.tsx
> Build failed because of webpack errors
error: script "build" exited with code 1
[zero@arch next-elysia-prisma]$ |
here is an example project https://github.com/0-don/next-elysia-prisma |
Still an issue in 1.2.10. Seeing this:
I had to switch from using |
This also happens while running a simple project with
|
Not sure if this would fix the problem since I couldn't replicate it on my end, but with b1bf2f2 which should be published under 1.2.13 might fixed the problem |
Unfortunately not fixed in 1.2.13:
However, I'm going to mark this as resolved. If you need Typebox in a Next.js build, you can switch to direct typebox imports instead:
|
or |
I forgot to warp another |
Maybe we can add test with Bun.build target web? |
The build script completed this time! But with warnings:
|
What version of Elysia is running?
1.2.2
What platform is your computer?
Darwin 24.1.0 arm64 arm
What steps can reproduce the bug?
In a Next.js project add a file that uses Typebox from Elysia:
Then build the project with
next build
.What is the expected behavior?
The build should succeed.
What do you see instead?
The build fails with:
Additional information
Rolling back to 1.1.27 fixes the problem.
Have you try removing the
node_modules
andbun.lockb
and try again yet?Yes
The text was updated successfully, but these errors were encountered: