@@ -8547,17 +8547,18 @@ let cache : string Coll.t = Coll.create 0
85478547
85488548let to_list cb =
85498549 Coll.to_list cache cb
8550-
8550+
85518551(* Some package managers will implement "postinstall" caches, that do not
85528552 * keep their build artifacts in the local node_modules. Similar to
85538553 * npm_config_prefix, bs_custom_resolution allows these to specify the
85548554 * exact location of build cache, but on a per-package basis. Implemented as
85558555 * environment lookup to avoid invasive changes to bsconfig and mandates. *)
8556- let custom_resolution () =
8557- match Sys.getenv "bs_custom_resolution" with
8556+ let custom_resolution = lazy
8557+ ( match Sys.getenv "bs_custom_resolution" with
85588558 | exception Not_found -> false
85598559 | "true" -> true
8560- | _ -> false
8560+ | _ -> false)
8561+
85618562
85628563let regex_at = Str.regexp "@"
85638564let regex_unders = Str.regexp "_+"
@@ -8574,11 +8575,12 @@ let pkg_name_as_variable pkg =
85748575
85758576(** TODO: collect all warnings and print later *)
85768577let resolve_bs_package ~cwd (package : t) =
8577- if custom_resolution () then
8578+ if Lazy.force custom_resolution then
85788579 begin
85798580 Bsb_log.info "@{<info>Using Custom Resolution@}@.";
85808581 let custom_pkg_loc = pkg_name_as_variable package ^ "__install" in
8581- match Sys.getenv custom_pkg_loc with
8582+ let custom_pkg_location = lazy (Sys.getenv custom_pkg_loc) in
8583+ match Lazy.force custom_pkg_location with
85828584 | exception Not_found ->
85838585 begin
85848586 Bsb_log.error
@@ -8625,7 +8627,6 @@ let resolve_bs_package ~cwd (package : t) =
86258627 x
86268628
86278629
8628-
86298630(** The package does not need to be a bspackage
86308631 example:
86318632 {[
0 commit comments