Skip to content

icon.svg is not included in standalone output #49009

@darthmaim

Description

@darthmaim

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
      Platform: linux
      Arch: x64
      Version: #1 SMP Fri Jan 27 02:56:13 UTC 2023
    Binaries:
      Node: 18.11.0
      npm: 8.19.2
      Yarn: 1.22.19
      pnpm: 7.28.0
    Relevant packages:
      next: 13.3.3-canary.0
      eslint-config-next: N/A
      react: 18.2.0
      react-dom: 18.2.0

Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Standalone mode (output: "standalone")

Link to the code that reproduces this issue

https://github.com/darthmaim/reproduction-next-icon-standalone

To Reproduce

  1. checkout https://github.com/darthmaim/reproduction-next-icon-standalone
  2. verify manually
    1. npm i
    2. npm run build
    3. Open .next/standalone/.next/server/app/icon.svg/route.js and see it contains an absolute path to the source file
  3. verify with with-docker example:
    1. docker build -t reproduction-next-icon-standalone .
    2. docker run -p 3000:3000 reproduction-next-icon-standalone
    3. Open http://localhost:3000/, see there is no favicon
    4. Inspect source, find <link rel="icon" ... in the head and open its url in a new tab
    5. See "Internal Server Error"
    6. See Error: ENOENT: no such file or directory, open '/app/app/icon.svg' in docker log

Describe the Bug

When using icon.svg (other meta files might be affected as well) they are not included in the standalone output. Instead the standalone output references absolute paths in the source directory.

This works when running the standalone build on the same machine that build it, but breaks if the standalone build is for example included in docker.

The reproduction includes the Dockerfile from the with-docker example to visualize this.

Expected Behavior

The standalone output should contain the icon.svg file and the icon.svg/route should not include an absolute path to the source directory.

Which browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

standalone

Metadata

Metadata

Assignees

No one assigned

    Labels

    MetadataRelated to Next.js' Metadata API.OutputRelated to the the output configuration option.bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions