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
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.
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
The text was updated successfully, but these errors were encountered:
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
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.
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
The text was updated successfully, but these errors were encountered: