@@ -929,6 +929,19 @@ if (__DEV__) {
929929 }
930930 } ;
931931
932+ // We skip getters, but only on non ESM output
933+ var isSpecifierSafeToCheck = (
934+ moduleExports : Exports ,
935+ key : string ,
936+ ) : boolean => {
937+ if ( moduleExports && moduleExports . __esModule ) {
938+ return true ;
939+ } else {
940+ const desc = Object . getOwnPropertyDescriptor ( moduleExports , key ) ;
941+ return ! desc || ! desc . get ;
942+ }
943+ } ;
944+
932945 // Modules that only export components become React Refresh boundaries.
933946 var isReactRefreshBoundary = function (
934947 Refresh : any ,
@@ -947,9 +960,7 @@ if (__DEV__) {
947960 hasExports = true ;
948961 if ( key === '__esModule' ) {
949962 continue ;
950- }
951- const desc = Object . getOwnPropertyDescriptor < any > ( moduleExports , key ) ;
952- if ( desc && desc . get ) {
963+ } else if ( ! isSpecifierSafeToCheck ( moduleExports , key ) ) {
953964 // Don't invoke getters as they may have side effects.
954965 return false ;
955966 }
@@ -994,9 +1005,7 @@ if (__DEV__) {
9941005 for ( const key in moduleExports ) {
9951006 if ( key === '__esModule' ) {
9961007 continue ;
997- }
998- const desc = Object . getOwnPropertyDescriptor < any > ( moduleExports , key ) ;
999- if ( desc && desc . get ) {
1008+ } else if ( ! isSpecifierSafeToCheck ( moduleExports , key ) ) {
10001009 continue;
10011010 }
10021011 const exportValue = moduleExports [ key ] ;
@@ -1018,8 +1027,7 @@ if (__DEV__) {
10181027 return ;
10191028 }
10201029 for ( const key in moduleExports ) {
1021- const desc = Object . getOwnPropertyDescriptor < any > ( moduleExports , key ) ;
1022- if ( desc && desc . get ) {
1030+ if ( ! isSpecifierSafeToCheck ( moduleExports , key ) ) {
10231031 // Don't invoke getters as they may have side effects.
10241032 continue ;
10251033 }
0 commit comments