Next.js AppRouter: not a valid export field
I've hit a wall when trying to add my own exports in a
route.ts
, side to side with GET
, POST
, etc
This forces me to have a separate file, that implement everything in exactly the same way, which I then export in route.ts
like so:
Have you encountered this ? is there any better practice around it ?
From what I can see, it is expected and documented, but I still think that should be allowed to avoid code duplication. So I created a discussion and (draft) PR on Github.
I though some here might be interested, and any feedback or upvote would be appreciated0 Replies