Link to the code that reproduces this issue
https://github.com/yukiyokotani/next-static-export-404-reproduce
To Reproduce
- The code in the linked repository is deployed in the following github pages with static export.
- This site only has a link to the root path:
/. If you look at the network tab in the developer tools, you will see that the RSC Payload request corresponding to the root path is 404.
Current vs. Expected behavior
Current:
Expected:
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.2.0
npm: 10.8.1
Yarn: 3.2.4
pnpm: 9.4.0
Relevant Packages:
next: 14.2.18 // An outdated version detected (latest is 15.0.3), upgrade is highly recommended!
eslint-config-next: 14.2.18
react: 18.3.1
react-dom: 18.3.1
typescript: 5.7.2
Next.js Config:
output: export
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next build (local), Other (Deployed)
Additional context
In the code output generated by Static Export, the request path for the RSC Payload .txt files is constructed by appending .txt to the page path if the path ends with '/', and by appending index.txt otherwise. When basePath is set and trailingSlash is disabled (default settings), the root path '/' is treated as '', and according to the mentioned logic, the RSC Payload .txt file path becomes {basePath}.txt. However, the RSC Payload .txt file corresponding to '/' in the Static Export output is always index.txt. As a result, when trying to access {basePath}.txt, which should be {basePath}/index.txt, a 404 error occurs.
Link to the code that reproduces this issue
https://github.com/yukiyokotani/next-static-export-404-reproduce
To Reproduce
/. If you look at the network tab in the developer tools, you will see that the RSC Payload request corresponding to the root path is 404.Current vs. Expected behavior
Current:
Expected:
index.txtand not a file likenext-static-export-404-reproduce.txt.Provide environment information
Which area(s) are affected? (Select all that apply)
Output (export/standalone)
Which stage(s) are affected? (Select all that apply)
next build (local), Other (Deployed)
Additional context
In the code output generated by Static Export, the request path for the RSC Payload
.txtfiles is constructed by appending.txtto the page path if the path ends with'/', and by appendingindex.txtotherwise. WhenbasePathis set andtrailingSlashis disabled (default settings), the root path'/'is treated as'', and according to the mentioned logic, the RSC Payload.txtfile path becomes{basePath}.txt. However, the RSC Payload.txtfile corresponding to'/'in the Static Export output is alwaysindex.txt. As a result, when trying to access{basePath}.txt, which should be{basePath}/index.txt, a 404 error occurs.