@@ -20,8 +20,10 @@ import type { CreateDiagnostic } from '../../types'
2020class DiagnosticsWatcher {
2121 private updateDiagnostics : any
2222 private svelteCheck : SvelteCheck
23+ private overlay : boolean
2324
24- constructor ( root : string , private overlay : boolean ) {
25+ public constructor ( root : string , overlay : boolean ) {
26+ this . overlay = overlay
2527 this . svelteCheck = new SvelteCheck ( root , {
2628 compilerWarnings : { } ,
2729 diagnosticSources : [ 'js' , 'svelte' , 'css' ] ,
@@ -64,7 +66,7 @@ class DiagnosticsWatcher {
6466 checker : 'svelte' ,
6567 } )
6668
67- if ( currErr == null ) {
69+ if ( currErr === null ) {
6870 currErr = diagnosticToViteError ( formattedDiagnostic )
6971 }
7072 logChunk += os . EOL + diagnosticToTerminalLog ( formattedDiagnostic , 'svelte' )
@@ -111,12 +113,13 @@ const createDiagnostic: CreateDiagnostic<'svelte'> = (pluginConfig) => {
111113 } ,
112114 configureServer ( { root } ) {
113115 invariant ( pluginConfig . svelte , 'config.svelte should be `false`' )
116+ let svelteRoot = root
114117
115118 if ( pluginConfig . svelte !== true && pluginConfig . svelte . root ) {
116- root = pluginConfig . svelte . root
119+ svelteRoot = pluginConfig . svelte . root
117120 }
118121
119- let watcher = new DiagnosticsWatcher ( root , overlay )
122+ let watcher = new DiagnosticsWatcher ( svelteRoot , overlay )
120123 return watcher
121124 } ,
122125 }
0 commit comments