@@ -30,9 +30,22 @@ protected internal void UseFileSystem(IFileSystem fileSystem)
3030 }
3131
3232 /// <summary>
33- /// Get the public directory and build path.
33+ /// Get the public directory
3434 /// </summary>
3535 private string GetPublicPathForFile ( string path )
36+ {
37+ var pieces = new List < string > {
38+ _options . Value . PublicDirectory ,
39+ path
40+ } ;
41+
42+ return string . Join ( "/" , pieces ) ;
43+ }
44+
45+ /// <summary>
46+ /// Get the public directory and build path.
47+ /// </summary>
48+ private string GetBuildPathForFile ( string path )
3649 {
3750 var pieces = new List < string > { _options . Value . PublicDirectory } ;
3851 if ( ! string . IsNullOrEmpty ( _options . Value . BuildDirectory ) )
@@ -54,12 +67,12 @@ public HtmlString Input(string path)
5467 return new HtmlString ( MakeModuleTag ( "@vite/client" ) . Value + MakeModuleTag ( path ) . Value ) ;
5568 }
5669
57- if ( ! _fileSystem . File . Exists ( GetPublicPathForFile ( _options . Value . ManifestFilename ) ) )
70+ if ( ! _fileSystem . File . Exists ( GetBuildPathForFile ( _options . Value . ManifestFilename ) ) )
5871 {
5972 throw new Exception ( "Vite Manifest is missing. Run `npm run build` and try again." ) ;
6073 }
6174
62- var manifest = _fileSystem . File . ReadAllText ( GetPublicPathForFile ( _options . Value . ManifestFilename ) ) ;
75+ var manifest = _fileSystem . File . ReadAllText ( GetBuildPathForFile ( _options . Value . ManifestFilename ) ) ;
6376 var manifestJson = JsonSerializer . Deserialize < Dictionary < string , JsonElement > > ( manifest ) ;
6477
6578 if ( manifestJson == null )
@@ -209,8 +222,8 @@ private static string GetString(IHtmlContent content)
209222
210223 public string ? GetManifest ( )
211224 {
212- return _fileSystem . File . Exists ( GetPublicPathForFile ( _options . Value . ManifestFilename ) )
213- ? _fileSystem . File . ReadAllText ( GetPublicPathForFile ( _options . Value . ManifestFilename ) )
225+ return _fileSystem . File . Exists ( GetBuildPathForFile ( _options . Value . ManifestFilename ) )
226+ ? _fileSystem . File . ReadAllText ( GetBuildPathForFile ( _options . Value . ManifestFilename ) )
214227 : null ;
215228 }
216229}
0 commit comments