Customer server with custom path
Hello,
I noticed an issue with a custom server, if the "react app" is not in the root folder. You can see that here : https://github.com/oxid83/simple-next-server
(node:5948) UnhandledPromiseRejectionWarning: Error: Cannot find module '/project_root_path/i18n'
It's just a simple custom server (sampled here : https://nextjs.org/docs/advanced-features/custom-server), and we use the "next-translate" example here : https://github.com/vercel/next.js/tree/canary/examples/with-next-translate
Do you have any ideas on how to fix that please ?
@devaquila you can fix it with an environment variable indicating the path: NEXT_TRANSLATE_PATH. Is documented here: https://github.com/vinissimus/next-translate#12-how-to-use-next-translate-in-a-mono-repo.
I close the issue. If you still having problems please comment here or reopen it
@aralroca thanks for you answer :)
But it's still the same (NEXT_TRANSLATE_PATH=./with-next-translate in the .env or in the environnement variable)
FYI, the sample is updated with this fix
@devaquila Ok, I reopen. Does it happen only with custom server? Tomorrow I'll try the example, I'm not at my computer right now.
Ok great. We have not tested without custom server. But if the ReactApp is in the root folder, it's working.
Hello,
I created a Pull request on your demo repo https://github.com/oxid83/simple-next-server/pull/1 (btw, when i tested, there was an error because of multiple react versions)
I tested to use the .env variable, but it didn't worked well so i used process.chdir() to move process.cwd()
Finally, I propose a modification to the README of next-translate here https://github.com/vinissimus/next-translate/pull/650