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 => {
4949}
5050
5151let 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+ )
5668 }
5769 let versions = {
58- let response = await fetch (bundleBaseUrl + "/playground-bundles/versions.json" )
70+ let response = await fetch (versionsBaseUrl + "/playground-bundles/versions.json" )
5971 let json = await WebAPI .Response .json (response )
6072 json
6173 -> JSON .Decode .array
You can’t perform that action at this time.
0 commit comments