4a7ab34baf
This updates our `yarn next` command to leverage react v18 by default and removes the need for the test require hook/config modifying when testing react 18. There are some fixtures we need to investigate react 18 support in follow-ups: - `test/integration/client-navigation-a11y` - `test/integration/critical-css` - `test/integration/custom-error-page-exception` - `test/integration/font-optimization` - AMP specific tests
17 lines
623 B
JavaScript
17 lines
623 B
JavaScript
const mod = require('module')
|
|
|
|
const hookPropertyMap = new Map([
|
|
['react', 'react-17'],
|
|
['react/jsx-runtime', 'react-17/jsx-runtime'],
|
|
['react/jsx-dev-runtime', 'react-17/jsx-dev-runtime'],
|
|
['react-dom', 'react-dom-17'],
|
|
['react-dom/server', 'react-dom-17/server'],
|
|
['react-dom/server.browser', 'react-dom-17/server.browser'],
|
|
])
|
|
|
|
const resolveFilename = mod._resolveFilename
|
|
mod._resolveFilename = function (request, parent, isMain, options) {
|
|
const hookResolved = hookPropertyMap.get(request)
|
|
if (hookResolved) request = hookResolved
|
|
return resolveFilename.call(mod, request, parent, isMain, options)
|
|
}
|