Fix: Build compilation warning when using middleware (#57685)
### Fixing a bug
- Related issues linked using `fixes #57533`
- Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs
- Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md
### What?
If there is a `middleware.js` or `middleware.ts` file in Next.JS 14, running `next build` shows the following warning:
```
./node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js
A Node.js module is loaded ('url' at line 3) which is not supported in the Edge Runtime.
Learn More: https://nextjs.org/docs/messages/node-module-in-edge-runtime
Import trace for requested module:
./node_modules/next/dist/esm/shared/lib/router/utils/app-paths.js
```
This PR will remove the warning.
Closes NEXT-
Fixes #57533