Recommended configuration for monorepo

I am trying to debug some redirects and headers issues present in my site, which is an app in an monorepo. I have a few questions so that I can make sure I have the correct setup:

  1. Where is the recommended location for _redirects and _headers files in a monorepo app? The docs at Build configuration overview | Netlify Docs mention to place them inside the publish/build directory. The docs at Introducing the Enhanced Monorepo Experience on Netlify | Netlify illustrate an example where the _redirects file is in the app root.

  2. Should I expect to see these files in the Deploy File Viewer for a netlify deploy? I am manually deploying the site via netlify deploy. In the deploy logs, it says that redirect and header rules are processed, but no _redirects or _headers files exist within the Deploy File Viewer.

  3. What is the recommended command when deploying a monorepo app via netlify deploy? Do I only need to add the filter option? e.g. netlify deploy --filter apps/my-app. I am deploying in a non-interactive environment and have tried many of the solutions here: CI failing with "We've detected multiple sites inside your repository" · Issue #5977 · netlify/cli · GitHub. To be clear, it is deploying, but I want to confirm that I am using the correct command.

@srubin There’s also this documentation which you may have read, but don’t seem to have linked to:

@nathanmartin Thank you. I’ve read that document and while it touches on several of the topics referenced in my post, I don’t believe it answers any of them directly.

Here’s an example of a correctly setup monorepo: hrishikesh-k/blog (github.com). In that, the _redirects and _headers would be in packages/site/public (as public is the folder that SvelteKit will automatically copy into build which is the publish path).

Yes

netlify deploy --build --filter=<package-name>

So with the above repo as an example, it would be:

netlify deploy --build --filter=@hrishikeshk/blog
1 Like

Thank you @hrishikesh. I think that answers most of my questions. I am still having issues seeing the _redirects and _headers files appear in the Netlify deploy file viewer, but I may open a separate issue for that.