@@ -30,9 +30,22 @@ protected internal void UseFileSystem(IFileSystem fileSystem)
30
30
}
31
31
32
32
/// <summary>
33
- /// Get the public directory and build path.
33
+ /// Get the public directory
34
34
/// </summary>
35
35
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 )
36
49
{
37
50
var pieces = new List < string > { _options . Value . PublicDirectory } ;
38
51
if ( ! string . IsNullOrEmpty ( _options . Value . BuildDirectory ) )
@@ -54,12 +67,12 @@ public HtmlString Input(string path)
54
67
return new HtmlString ( MakeModuleTag ( "@vite/client" ) . Value + MakeModuleTag ( path ) . Value ) ;
55
68
}
56
69
57
- if ( ! _fileSystem . File . Exists ( GetPublicPathForFile ( _options . Value . ManifestFilename ) ) )
70
+ if ( ! _fileSystem . File . Exists ( GetBuildPathForFile ( _options . Value . ManifestFilename ) ) )
58
71
{
59
72
throw new Exception ( "Vite Manifest is missing. Run `npm run build` and try again." ) ;
60
73
}
61
74
62
- var manifest = _fileSystem . File . ReadAllText ( GetPublicPathForFile ( _options . Value . ManifestFilename ) ) ;
75
+ var manifest = _fileSystem . File . ReadAllText ( GetBuildPathForFile ( _options . Value . ManifestFilename ) ) ;
63
76
var manifestJson = JsonSerializer . Deserialize < Dictionary < string , JsonElement > > ( manifest ) ;
64
77
65
78
if ( manifestJson == null )
@@ -209,8 +222,8 @@ private static string GetString(IHtmlContent content)
209
222
210
223
public string ? GetManifest ( )
211
224
{
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 ) )
214
227
: null ;
215
228
}
216
229
}
0 commit comments