`entries` export only accepts one export per route, but doesn't warn about this behavior
@elliott-with-the-longest-name-on-github is already working on this.
Since May 20, 2023.
- Dominant language
- JavaScript
- Stars
- 20.8k
- Forks
- 2.3k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 156
Description
Describe the bug
If I export entries from +page, +page.server, and +server in the same route, only one of them will be run and used to generate the prerender entries. We should:
- Throw an error when more than one
entriesdeclaration is found in the same route - Document the precedence, and this behavior
Reproduction
I'm not going to create a reproduction, since I'll be fixing this -- but if you want to do it yourself, create all three of the files mentioned above in a [slug] route, export entries from all three (with different return values), then run build. You'll only get the values from one of them built.
Logs
No response
System Info
no
Severity
annoyance
Additional Information
I also considered that we could merge the results from all of the entries exports, but that seems like encouraging silly behavior -- there's not any conceivable reason to want to have multiple entries exports per route.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.