File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed
packages/vite-plugin-svelte/src Expand file tree Collapse file tree 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[] {
236236 }
237237 logCompilerWarnings ( svelteRequest , compileData . compiled . warnings , options ) ;
238238 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+ }
243249 }
244250 log . debug ( `transform returns compiled js for ${ svelteRequest . filename } ` ) ;
245251 return {
You can’t perform that action at this time.
0 commit comments