1
1
module ModuleNameMap = Map. Make (ModuleName )
2
2
3
3
type module_ = CommonJS | ES6
4
+ type moduleResolution = Node | Node16 | Bundler
4
5
type bsVersion = int * int * int
5
6
6
7
type t = {
@@ -13,6 +14,7 @@ type t = {
13
14
exportInterfaces : bool ;
14
15
generatedFileExtension : string option ;
15
16
module_ : module_ ;
17
+ moduleResolution : moduleResolution ;
16
18
namespace : string option ;
17
19
platformLib : string ;
18
20
mutable projectRoot : string ;
@@ -32,6 +34,7 @@ let default =
32
34
exportInterfaces = false ;
33
35
generatedFileExtension = None ;
34
36
module_ = ES6 ;
37
+ moduleResolution = Node ;
35
38
namespace = None ;
36
39
platformLib = " " ;
37
40
projectRoot = " " ;
@@ -112,6 +115,7 @@ let readConfig ~getBsConfigFile ~namespace =
112
115
in
113
116
let parseConfig ~bsconf ~gtconf =
114
117
let moduleString = gtconf |> getStringOption " module" in
118
+ let moduleResolutionString = gtconf |> getStringOption " moduleResolution" in
115
119
let exportInterfacesBool = gtconf |> getBool " exportInterfaces" in
116
120
let generatedFileExtensionStringOption =
117
121
gtconf |> getStringOption " generatedFileExtension"
@@ -143,6 +147,13 @@ let readConfig ~getBsConfigFile ~namespace =
143
147
| None , Some ("es6" | "es6-global" ) -> ES6
144
148
| _ -> default.module_
145
149
in
150
+ let moduleResolution =
151
+ match moduleResolutionString with
152
+ | Some "node" -> Node
153
+ | Some "node16" -> Node16
154
+ | Some "bundler" -> Bundler
155
+ | _ -> default.moduleResolution
156
+ in
146
157
let exportInterfaces =
147
158
match exportInterfacesBool with
148
159
| None -> default.exportInterfaces
@@ -204,6 +215,7 @@ let readConfig ~getBsConfigFile ~namespace =
204
215
exportInterfaces;
205
216
generatedFileExtension;
206
217
module_;
218
+ moduleResolution;
207
219
namespace;
208
220
platformLib;
209
221
projectRoot;
0 commit comments