Skip to content

Commit f82d6f3

Browse files
committed
fix symlink loop while running clean command
1 parent e80bea1 commit f82d6f3

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

compiler/bsb/bsb_parse_sources.ml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,16 +401,17 @@ and walk_source_dir_map (cxt : walk_cxt) sub_dirs_field =
401401
TODO: make it configurable
402402
*)
403403
let clean_re_js root =
404-
match
405-
Ext_json_parse.parse_json_from_file
406-
(Filename.concat root Literals.rescript_json)
407-
with
404+
let rescript_json = Filename.concat root Literals.rescript_json in
405+
match Ext_json_parse.parse_json_from_file rescript_json with
408406
| Obj {map} ->
409407
let ignored_dirs =
408+
(* Always ignore node_modules to avoid symlink loops *)
409+
let base_ignored = Set_string.singleton Literals.node_modules in
410410
match map.?(Bsb_build_schemas.ignored_dirs) with
411411
| Some (Arr {content = x}) ->
412-
Set_string.of_list (Bsb_build_util.get_list_string x)
413-
| Some _ | None -> Set_string.empty
412+
Set_string.union base_ignored
413+
(Set_string.of_list (Bsb_build_util.get_list_string x))
414+
| Some _ | None -> base_ignored
414415
in
415416
let gentype_language =
416417
match map.?(Bsb_build_schemas.gentypeconfig) with

0 commit comments

Comments
 (0)