@@ -28,9 +28,9 @@ export const defineConfig = (
28
28
| Options
29
29
| Options [ ]
30
30
| ( (
31
- /** The options derived from CLI flags */
32
- overrideOptions : Options
33
- ) => MaybePromise < Options | Options [ ] > )
31
+ /** The options derived from CLI flags */
32
+ overrideOptions : Options
33
+ ) => MaybePromise < Options | Options [ ] > )
34
34
) => options
35
35
36
36
const killProcess = ( {
@@ -67,8 +67,8 @@ const normalizeOptions = async (
67
67
? { }
68
68
: undefined
69
69
: typeof _options . dts === 'string'
70
- ? { entry : _options . dts }
71
- : _options . dts ,
70
+ ? { entry : _options . dts }
71
+ : _options . dts ,
72
72
}
73
73
74
74
setSilent ( options . silent )
@@ -120,9 +120,9 @@ export async function build(_options: Options) {
120
120
_options . config === false
121
121
? { }
122
122
: await loadTsupConfig (
123
- process . cwd ( ) ,
124
- _options . config === true ? undefined : _options . config
125
- )
123
+ process . cwd ( ) ,
124
+ _options . config === true ? undefined : _options . config
125
+ )
126
126
127
127
const configData =
128
128
typeof config . data === 'function'
@@ -272,16 +272,17 @@ export async function build(_options: Options) {
272
272
typeof options . watch === 'boolean'
273
273
? '.'
274
274
: Array . isArray ( options . watch )
275
- ? options . watch . filter (
275
+ ? options . watch . filter (
276
276
( path ) : path is string => typeof path === 'string'
277
277
)
278
- : options . watch
278
+ : options . watch
279
279
280
280
logger . info (
281
281
'CLI' ,
282
- `Watching for changes in ${ Array . isArray ( watchPaths )
283
- ? watchPaths . map ( ( v ) => '"' + v + '"' ) . join ( ' | ' )
284
- : '"' + watchPaths + '"'
282
+ `Watching for changes in ${
283
+ Array . isArray ( watchPaths )
284
+ ? watchPaths . map ( ( v ) => '"' + v + '"' ) . join ( ' | ' )
285
+ : '"' + watchPaths + '"'
285
286
} `
286
287
)
287
288
logger . info (
@@ -298,8 +299,12 @@ export async function build(_options: Options) {
298
299
} )
299
300
watcher . on ( 'all' , ( type , file ) => {
300
301
file = slash ( file )
301
- if ( ! buildDependencies . has ( file ) ) return
302
-
302
+ // By default we only rebuild when imported files change
303
+ // If you specify custom `watch`, a string or multiple strings
304
+ // We rebuild when those files change
305
+ if ( options . watch === true && ! buildDependencies . has ( file ) ) {
306
+ return
307
+ }
303
308
logger . info ( 'CLI' , `Change detected: ${ type } ${ file } ` )
304
309
debouncedBuildAll ( )
305
310
} )
0 commit comments