mirror of
https://github.com/zebrajr/react.git
synced 2025-12-06 12:20:20 +01:00
## Summary
Fixes a type validation error introduced in newer versions of Node.js
when calling `Module.prototype._compile` in our unit tests. (I tried but
have yet to pinpoint the precise change in Node.js that introduced this
vaildation.)
The specific error that currently occurs when running unit tests with
Node.js v18.16.1:
```
TypeError: The "mod" argument must be an instance of Module. Received an instance of Object
80 |
81 | if (useServer) {
> 82 | originalCompile.apply(this, arguments);
| ^
83 |
84 | const moduleId: string = (url.pathToFileURL(filename).href: any);
85 |
```
This fixes the type validation error by mocking modules using `new
Module()` instead of plain objects.
## How did you test this change?
Ran the unit tests successfully:
```
$ node --version
v18.16.1
$ yarn test
```
|
||
|---|---|---|
| .. | ||
| esm | ||
| npm | ||
| src | ||
| client.browser.js | ||
| client.edge.js | ||
| client.js | ||
| client.node.js | ||
| client.node.unbundled.js | ||
| index.js | ||
| node-register.js | ||
| package.json | ||
| plugin.js | ||
| README.md | ||
| server.browser.js | ||
| server.edge.js | ||
| server.js | ||
| server.node.js | ||
| server.node.unbundled.js | ||
react-server-dom-webpack
Experimental React Flight bindings for DOM using Webpack.
Use it at your own risk.