fix: node.js module import error when using middleware (#77945)
The previous [backport](https://github.com/vercel/next.js/pull/77794)
caused an issue due to how imports are resolved on canary vs v14,
resulting in a message about using node.js APIs in middleware.
This moves the import to the `web` directory and adds a test case for
the warning.
Closes NDX-1014