@@ -22,24 +22,6 @@ process.env.BSB_PROJECT_ROOT = cwd;
22
22
const isTtyError = process . stderr . isTTY ;
23
23
const isTtyStd = process . stdout . isTTY ;
24
24
25
- var bsConfig = "bsconfig.json"
26
- var resConfig = "rescript.json" ;
27
- var resConfigFile = path . join ( cwd , resConfig ) ;
28
- if ( ! fs . existsSync ( resConfigFile ) ) {
29
- resConfig = bsConfig ;
30
- resConfigFile = path . join ( cwd , bsConfig ) ;
31
- }
32
-
33
- // If the project uses gentype and uses custom file extension
34
- // via generatedFileExtension, ignore them in watch mode
35
- var genTypeFileExtension = ".gen.tsx" ;
36
- if ( fs . existsSync ( resConfigFile ) ) {
37
- var genTypeConfig = require ( resConfigFile ) . gentypeconfig
38
- if ( genTypeConfig ) {
39
- genTypeFileExtension = genTypeConfig . generatedFileExtension ;
40
- }
41
- }
42
-
43
25
let verbose = false ;
44
26
45
27
/**
@@ -239,6 +221,14 @@ if (maybeSubcommand === "build" && process_argv.includes("-w")) {
239
221
let webSocketHost = "localhost" ;
240
222
let webSocketPort = 9999 ;
241
223
224
+ let resConfig = "rescript.json" ;
225
+ let resConfigFile = path . join ( cwd , resConfig ) ;
226
+ if ( ! fs . existsSync ( resConfigFile ) ) {
227
+ const bsConfig = "bsconfig.json" ;
228
+ resConfig = bsConfig ;
229
+ resConfigFile = path . join ( cwd , bsConfig ) ;
230
+ }
231
+
242
232
const sourcedirs = path . join ( "lib" , "bs" , ".sourcedirs.json" ) ;
243
233
244
234
let LAST_BUILD_START = 0 ;
@@ -364,14 +354,13 @@ Please pick a different one using the \`-ws [host:]port\` flag from bsb.`);
364
354
// This could cause problems if source builds (generating js files in the same directory) are supported.
365
355
if ( ! fileName ) return true ;
366
356
367
- return ! (
368
- fileName === ".merlin" ||
369
- fileName . endsWith ( ".js" ) ||
370
- fileName . endsWith ( ".mjs" ) ||
371
- fileName . endsWith ( ".cjs" ) ||
372
- fileName . endsWith ( genTypeFileExtension ) ||
373
- watchGenerated . indexOf ( fileName ) >= 0 ||
374
- fileName . endsWith ( ".swp" )
357
+ return (
358
+ ( ( fileName . endsWith ( ".res" ) ||
359
+ fileName . endsWith ( ".resi" ) ||
360
+ fileName . endsWith ( ".ml" ) ||
361
+ fileName . endsWith ( ".mli" ) ) &&
362
+ ! watchGenerated . includes ( fileName ) ) ||
363
+ fileName === resConfig
375
364
) ;
376
365
}
377
366
0 commit comments