File tree 2 files changed +15
-4
lines changed
packages/vite-plugin-svelte/src
2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @sveltejs/vite-plugin-svelte ' : patch
3
+ ---
4
+
5
+ fix(build): watch preprocessor dependencies during build --watch
Original file line number Diff line number Diff line change @@ -236,10 +236,16 @@ export function svelte(inlineOptions?: Partial<Options>): Plugin[] {
236
236
}
237
237
logCompilerWarnings ( svelteRequest , compileData . compiled . warnings , options ) ;
238
238
cache . update ( compileData ) ;
239
- if ( compileData . dependencies ?. length && options . server ) {
240
- compileData . dependencies . forEach ( ( d ) => {
241
- ensureWatchedFile ( options . server ! . watcher , d , options . root ) ;
242
- } ) ;
239
+ if ( compileData . dependencies ?. length ) {
240
+ if ( options . server ) {
241
+ for ( const dep of compileData . dependencies ) {
242
+ ensureWatchedFile ( options . server . watcher , dep , options . root ) ;
243
+ }
244
+ } else if ( options . isBuild && viteConfig . build . watch ) {
245
+ for ( const dep of compileData . dependencies ) {
246
+ this . addWatchFile ( dep ) ;
247
+ }
248
+ }
243
249
}
244
250
log . debug ( `transform returns compiled js for ${ svelteRequest . filename } ` ) ;
245
251
return {
You can’t perform that action at this time.
0 commit comments