File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
packages/app/src/sandbox/eval/presets/create-react-app Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,15 @@ import semver from 'semver';
2
2
import { getAbsoluteDependencies } from '@codesandbox/common/lib/utils/dependencies' ;
3
3
import Manager from 'sandbox/eval/manager' ;
4
4
5
+ function isMinimalSemverVersion ( version : string , minimalVersion : string ) {
6
+ try {
7
+ return semver . gte ( version , minimalVersion ) ;
8
+ } catch ( e ) {
9
+ // Semver couldn't be parsed, we assume that we're on the bleeding edge now, so true.
10
+ return true ;
11
+ }
12
+ }
13
+
5
14
export async function isMinimalReactVersion (
6
15
version : string ,
7
16
minimalVersion : string
@@ -13,7 +22,7 @@ export async function isMinimalReactVersion(
13
22
14
23
return (
15
24
absoluteDependencies [ 'react-dom' ] . startsWith ( '0.0.0' ) ||
16
- semver . gte ( absoluteDependencies [ 'react-dom' ] , minimalVersion )
25
+ isMinimalSemverVersion ( absoluteDependencies [ 'react-dom' ] , minimalVersion )
17
26
) ;
18
27
}
19
28
You can’t perform that action at this time.
0 commit comments