Skip to content

Commit 5fb190c

Browse files
committed
playground: set global for the compatibility reason
But playground should adopt module.
1 parent 0f071df commit 5fb190c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

compiler/jsoo/jsoo_playground_main.ml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -674,9 +674,14 @@ module Export = struct
674674
end
675675

676676
let () =
677-
Js.export "rescript_compiler"
678-
(object%js
679-
val api_version = api_version
680-
val version = Bs_version.version
681-
method make = Export.make ()
682-
end)
677+
let compiler =
678+
object%js
679+
val api_version = api_version
680+
val version = Bs_version.version
681+
method make = Export.make ()
682+
end
683+
in
684+
Js.export "rescript_compiler" compiler;
685+
686+
(* Prefer module export, but keep global variable for playground compatibility *)
687+
Js.Unsafe.set Js.Unsafe.global "rescript_compiler" compiler

0 commit comments

Comments
 (0)