Turbopack: add a simple `require` implementation at runtime for CJS checks (#6260)
This adds a simple `require` implementation passed into module factories
at runtime so that checks for CommonJS environments that use `typeof
require` etc. pass, and exports are correctly registered. For example:
```
if (typeof require !== "undefined" && typeof exports !== "undefined") {
exports.foo = "foo";
}
```
Test Plan: Our execution tests don't support browser environments, so
it's not straightforward to test in a meaningful and automated way.
Instead, tested manually with an app with a module like the above.
Closes WEB-1835