File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -49,13 +49,25 @@ let default = props => {
49
49
}
50
50
51
51
let getStaticProps : Next .GetStaticProps .t <props , _ > = async _ => {
52
- let bundleBaseUrl = switch (Node .Process .Env .playgroundBundleEndpoint , Node .Process .Env .nodeEnv ) {
53
- | (Some (baseUrl ), _ ) => baseUrl
54
- | (None , "development" ) => "https://cdn.rescript-lang.org"
55
- | (None , _ ) => ""
52
+ let (bundleBaseUrl , versionsBaseUrl ) = switch (
53
+ Node .Process .Env .playgroundBundleEndpoint ,
54
+ Node .Process .Env .nodeEnv ,
55
+ ) {
56
+ | (Some (baseUrl ), _ ) => (baseUrl , baseUrl )
57
+ | (None , "development" ) => {
58
+ // Use remote bundles in dev
59
+ let baseUrl = "https://cdn.rescript-lang.org"
60
+ (baseUrl , baseUrl )
61
+ }
62
+ | (None , _ ) => (
63
+ // Use same-origin requests for the bundle
64
+ "" ,
65
+ // There is no version endpoint in the build phase
66
+ "https://cdn.rescript-lang.org" ,
67
+ )
56
68
}
57
69
let versions = {
58
- let response = await fetch (bundleBaseUrl + "/playground-bundles/versions.json" )
70
+ let response = await fetch (versionsBaseUrl + "/playground-bundles/versions.json" )
59
71
let json = await WebAPI .Response .json (response )
60
72
json
61
73
-> JSON .Decode .array
You can’t perform that action at this time.
0 commit comments