Skip to content
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

Nx Nextjs build crashes with error "Module not found: Can't resolve 'fs'" For ISR Pages #84

Open
smithgajjar09 opened this issue Jul 13, 2024 · 0 comments

Comments

@smithgajjar09
Copy link

smithgajjar09 commented Jul 13, 2024

What version of this package are you using?
2.6.2

What operating system, Node.js, and npm version?
Mac, node - v18.17.1, npm - 9.6.7

What happened?

When i am using next-translate inside next.config.js it breaks my app with following error message -
Module not found: Can't resolve 'fs'
But when remove next-translate from next.config.js, it works fine and also builds the code. Interestingly when I use next-translate along with appWithI18n in _app it starts working again with no issues in the build (Please note even if i have used appWithI18n, loader prop is not set in i18n.js config file)

On digging further found out that this might be causing due to ISR pages, I have both getStaticProps and getServerSideProps to support ISR. When i build my app with next-translate it uses only getStaticProps as loader and does not include getServerSideProps for ISR as a part of the build. Due to which it causes server side code to be included inside client bundle and thus causing above error.

image

Is there a way to support ISR pages as well for i18n ?

What did you expect to happen?
Should build next app

Are you willing to submit a pull request to fix this bug?
No

@smithgajjar09 smithgajjar09 changed the title Nx Nextjs build crashes with error "Module not found: Can't resolve 'fs'" Nx Nextjs build crashes with error "Module not found: Can't resolve 'fs'" For ISR Pages Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant