next.js: `outputStandalone` option does not include public directory in monorepo setup

Run next info (available from version 12.0.8 and up)

Operating System: Platform: linux Arch: x64 Version: #103-Ubuntu SMP Fri Nov 26 16:13:00 UTC 2021 Binaries: Node: 16.12.0 npm: 8.1.0 Yarn: 1.22.15 pnpm: N/A Relevant packages: next: 12.0.9 react: 17.0.2 react-dom: 17.0.2

What version of Next.js are you using?

12.0.9

What version of Node.js are you using?

16.12.0

What browser are you using?

Chromium Edge

What operating system are you using?

Linux

How are you deploying your application?

next build with outputStandalone: true

Describe the Bug

outputStandalone server does not include the public directory in a monorepo with multiple referencing packages, so files such as robots.txt and favicon.ico that live in those directories are not present.

Expected Behavior

outputStandalone should include the public directory in the server it creates

To Reproduce

Have a monorepo with multiple packages referencing each other. I am using Turborepo. Build with output standalone and notice that server.js is output to standalone/apps/web/server.js instead of the root of the standalone dir.

Workaround

Copy the public directory to standalone/apps/web.

Sorry for the lack of a repro - hopefully someone with a ton more knowledge of the inner workings of this experiment can trivially pinpoint this. Thanks for all of y’alls work!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

I am using outputFileTracingRoot - the bug occurs with it.

~~Here is a basic reproduction: https://github.com/JoeyEamigh/output-standalone-monorepo-poc~~

From this experimentation I believe the bug is related to outputFileTracingRoot

I tried to get the reproduction working side-by-side with a working build, but unfortunately there seems to be an unrelated bug either in yarn or Turbo preventing me from doing so.

The ReadMe has more info on the reproduction and has some fancy file trees to look at. Thanks for everyone’s hard work!

This repro is for a different issue my bad

Thanks, @palmithor but that seems to be an issue on NX, so unrelated to this report IMO.

See a related open issue there: https://github.com/nrwl/nx/issues/9017 Another discussion around this is here: https://github.com/nrwl/nx/discussions/7946

I will make one tonight sorry - it should happen in the default TurboRepo starter if I am right about what causes it.