hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
115 stars 30 forks source link

fix: add custom pages directory support for NX or Monorepo solutions #24

Closed peacecwz closed 2 years ago

peacecwz commented 2 years ago

Problem

If your nextjs project is working on NX Monorepo solutions. It cannot work because It's looking hardcoded defined paths like "src/pages", "/pages" etc. but NX Monorepo is using like "apps//src/pages" and It doesn't work. NX running commands are only working on root directory. config.tsx line 406 is using process.cwd and it's not supporting custom pages directory

Solution

I added "pagesDirectory" config into harcoded paths and It will work now