-
Notifications
You must be signed in to change notification settings - Fork 27.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
icon.svg is not included in standalone output #49009
Comments
Seeing the same issue with a PNG file (i.e. |
Probably a duplicate of #48962. |
Close it as duplicate of #48962, let's track there 🙏 |
For your reproduction you also need to include |
Then the |
Identified the issue that the cache missing is caused by other reason, fixing |
Fixes #48962 Fixes #49009 Fixes #49107 ### Why For standalone mode the `fs.readFile` is executed for `route.js` when the module is loaded, then the fs operation aginst the wrong file path will break the proper module loading, then it fallbacks to `/_error` module. ### What We move the fs read operation to the first get then cache the buffer in the module level variable, so that `fs.readFile` won't be executed. As we already have prerender cache, the meta/body fs cache will be HIT and served
We got a fix out in 13.4, upgrade it to check it out if resolves the issue 🙏 |
Confirmed working now, thanks for the fix ❤️ |
Thank you for the detailed writing for reproduction steps, was super helpful to me when I investigated with docker 🙏 |
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Verify 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
npm i
npm run build
.next/standalone/.next/server/app/icon.svg/route.js
and see it contains an absolute path to the source filewith-docker
example:docker build -t reproduction-next-icon-standalone .
docker run -p 3000:3000 reproduction-next-icon-standalone
<link rel="icon" ...
in thehead
and open its url in a new tabError: ENOENT: no such file or directory, open '/app/app/icon.svg'
in docker logDescribe 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
The text was updated successfully, but these errors were encountered: