10up / headstartwp

Build a headless website fast with WordPress, the world’s most popular CMS, and Next.js, the most popular React framework. A free and open source solution by the experts at 10up.
https://headstartwp.10up.com
160 stars 17 forks source link

`next start path-to-project` breaks config loading. #746

Open nicholasio opened 6 months ago

nicholasio commented 6 months ago

Describe the bug

Because next start path-to-project apparentlys makes process.cwd() be where the next command was executed from, it breaks config loading.

I'm not sure if we can actually fix this, maybe we just need to document that next path-to-project isn't supported by HeadstartWP

Steps to Reproduce

  1. Do a build
  2. From the root of the monorepo run next start projects/wp-nextjs
  3. See an error about the config.
  4. Now run next start directly in projects/wp-nextjs and there's not issue.

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

Tanu1201 commented 5 months ago

Hey, can I take this up?

nicholasio commented 5 months ago

@Tanu1201 feel free to pick this up, I'm sure not sure what the workaround would be. withHeadstartWPConfig makes the assumption that it is being called from the next.js root directory to load some files automatically.

uglyrobot commented 2 weeks ago

Related https://github.com/10up/headstartwp/issues/866