File tree 2 files changed +14
-4
lines changed
frameworks/nextjs/src/config
2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ export const configureConfig = async ({
33
33
) ;
34
34
}
35
35
if ( tryResolve ( 'next/dist/compiled/react-dom' ) ) {
36
- addScopedAlias ( baseConfig , 'react-dom$ ' , 'next/dist/compiled/react-dom' ) ;
36
+ addScopedAlias ( baseConfig , 'react-dom' , 'next/dist/compiled/react-dom' ) ;
37
37
}
38
38
39
39
setupRuntimeConfig ( baseConfig , nextConfig ) ;
Original file line number Diff line number Diff line change 2
2
// https://github.com/testing-library/react-testing-library/blob/3dcd8a9649e25054c0e650d95fca2317b7008576/src/act-compat.js
3
3
import * as React from 'react' ;
4
4
5
- import * as DeprecatedReactTestUtils from 'react-dom/test-utils' ;
6
-
7
5
declare const globalThis : {
8
6
IS_REACT_ACT_ENVIRONMENT : boolean ;
9
7
} ;
10
8
9
+ let reactDomTestUtils ;
10
+
11
+ try {
12
+ reactDomTestUtils = require ( 'react-dom/test-utils' ) ;
13
+ } catch ( e ) {
14
+ reactDomTestUtils = {
15
+ act : async ( cb : ( ( ) => void ) | ( ( ) => Promise < void > ) ) => {
16
+ await cb ( ) ;
17
+ } ,
18
+ } ;
19
+ }
20
+
11
21
// @ts -expect-error act might not be available in some versions of React
12
- const reactAct = typeof React . act === 'function' ? React . act : DeprecatedReactTestUtils . act ;
22
+ const reactAct = typeof React . act === 'function' ? React . act : reactDomTestUtils . act ;
13
23
14
24
export function setReactActEnvironment ( isReactActEnvironment : boolean ) {
15
25
globalThis . IS_REACT_ACT_ENVIRONMENT = isReactActEnvironment ;
You can’t perform that action at this time.
0 commit comments