fix: Prevent duplicate file entries in modulesCode (#82550)
Fixes: https://github.com/vercel/next.js/issues/82515
When global-error, and presumably other similar files are defined by
users,`next build` (Webpack) outputs this to
`.next/server/app/page.js`(removed some values for brevity, see OP for
more):
```js
layout: [/* */],
"global-error": [() => Promise.resolve().then(c.bind(c, 6076)), "/my-app/app/global-error.tsx"],
"global-error": [() => Promise.resolve().then(c.bind(c, 6076)), "/my-app/app/global-error.tsx"],
"not-found": [/* */],
forbidden: [/* */],
unauthorized: [/* */],
metadata: { /* content */ }
```
Since this is then loaded into memory (copied to a JS file that's later
parsed - rather), the last `global-error` key is used ( `{a: 0, a: 100}`
is just `{a: 100}`) - In this case though, the duplicate keys have the
same value too which makes this a **nice** to fix.
This PR does a `reduceRight` pass checking if we have seen this `file`
already, if so, skip. That should be safe enough to not introduce
regressions.
Verified Turbopack builds just for the sake of it - no "issue" there.