From 64dbabdfd33885ef0cd54d3fbaba50ffd746e6d2 Mon Sep 17 00:00:00 2001 From: Christoph Knittel Date: Sat, 22 Jun 2024 20:40:01 +0200 Subject: [PATCH] Omit standard library dir from load path if -nostdlib is set --- CHANGELOG.md | 4 ++++ jscomp/core/res_compmisc.ml | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f52af6154..a4498d9c2a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,10 @@ # 11.1.3-rc.1 +#### :bug: Bug Fix + +- Omit standard library dir from load path if -nostdlib is set. https://github.com/rescript-lang/rescript-compiler/pull/6833 + # 11.1.2 #### :bug: Bug Fix diff --git a/jscomp/core/res_compmisc.ml b/jscomp/core/res_compmisc.ml index 1c7f3974e3..6213e2e022 100644 --- a/jscomp/core/res_compmisc.ml +++ b/jscomp/core/res_compmisc.ml @@ -27,7 +27,9 @@ let init_path () = let exp_dirs = List.map (Misc.expand_directory Config.standard_library) dirs in - Config.load_path := List.rev_append exp_dirs [Config.standard_library]; + Config.load_path := + if !Js_config.no_stdlib then exp_dirs + else (List.rev_append exp_dirs [Config.standard_library]); Env.reset_cache () (* Return the initial environment in which compilation proceeds. *)