@@ -223,7 +223,7 @@ function getBscArgs(
223
223
) {
224
224
return Promise . resolve ( rewatchCacheEntry . compilerArgs ) ;
225
225
}
226
- return new Promise ( ( resolve , _reject ) => {
226
+ return new Promise ( async ( resolve , _reject ) => {
227
227
function resolveResult ( result : Array < string > | RewatchCompilerArgs ) {
228
228
if ( stat != null && Array . isArray ( result ) ) {
229
229
entry . buildNinja = {
@@ -295,6 +295,20 @@ function getBscArgs(
295
295
entry . project . workspaceRootPath ,
296
296
"node_modules/@rolandpeelen/rewatch/rewatch"
297
297
) ;
298
+ if ( semver . valid ( project . rescriptVersion ) &&
299
+ semver . satisfies ( project . rescriptVersion as string , ">11" , { includePrerelease : true } ) ) {
300
+ const rescriptRewatchPath = await utils . findRewatchBinary ( entry . project . workspaceRootPath )
301
+ if ( rescriptRewatchPath != null ) {
302
+ rewatchPath = rescriptRewatchPath ;
303
+ if ( debug ( ) ) {
304
+ console . log ( `Found rewatch binary bundled with v12: ${ rescriptRewatchPath } ` )
305
+ }
306
+ } else {
307
+ if ( debug ( ) ) {
308
+ console . log ( "Did not find rewatch binary bundled with v12" )
309
+ }
310
+ }
311
+ }
298
312
const compilerArgs = JSON . parse (
299
313
cp
300
314
. execFileSync ( rewatchPath , [
@@ -536,6 +550,10 @@ async function figureOutBscArgs(entry: IncrementallyCompiledFileInfo) {
536
550
"-I" ,
537
551
path . resolve ( entry . project . rootPath , c . compilerOcamlDirPartialPath )
538
552
) ;
553
+ } else if ( value . startsWith ( ".." ) && value . endsWith ( "ocaml" ) ) {
554
+ // This should be the lib/ocaml folder of the project
555
+ // This is a hack to support incremental compilation in monorepos
556
+ callArgs . push ( "-I" , path . resolve ( entry . project . incrementalFolderPath , ".." , ".." , "ocaml" ) ) ;
539
557
} else {
540
558
callArgs . push ( "-I" , value ) ;
541
559
}
0 commit comments