Skip to content

Commit 0d29c7f

Browse files
committed
Script files need to be relative to webroot, not approot.
1 parent 377ac95 commit 0d29c7f

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/React.AspNet/AspNetFileSystem.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
using System.IO;
11-
using Microsoft.Framework.Runtime;
11+
using Microsoft.AspNet.Hosting;
1212

1313
namespace React.AspNet
1414
{
@@ -18,15 +18,15 @@ namespace React.AspNet
1818
/// </summary>
1919
public class AspNetFileSystem : FileSystemBase
2020
{
21-
private readonly IApplicationEnvironment _appEnvironment;
21+
private readonly IHostingEnvironment _hostingEnv;
2222

2323
/// <summary>
2424
/// Initializes a new instance of the <see cref="AspNetFileSystem"/> class.
2525
/// </summary>
26-
/// <param name="appEnvironment">The ASP.NET 5 application environment</param>
27-
public AspNetFileSystem(IApplicationEnvironment appEnvironment)
26+
/// <param name="hostingEnv">The ASP.NET 5 hosting environment</param>
27+
public AspNetFileSystem(IHostingEnvironment hostingEnv)
2828
{
29-
_appEnvironment = appEnvironment;
29+
_hostingEnv = hostingEnv;
3030
}
3131

3232
/// <summary>
@@ -37,7 +37,7 @@ public AspNetFileSystem(IApplicationEnvironment appEnvironment)
3737
public override string MapPath(string relativePath)
3838
{
3939
relativePath = relativePath.TrimStart('~').TrimStart('/');
40-
return Path.Combine(_appEnvironment.ApplicationBasePath, relativePath);
40+
return Path.Combine(_hostingEnv.WebRoot, relativePath);
4141
}
4242
}
4343
}

src/React.Sample.Mvc6/Startup.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF
6969
.SetUseHarmony(true)
7070
.SetReuseJavaScriptEngines(true)
7171
.SetStripTypes(true)
72-
.AddScript("~/wwwroot/js/Sample.jsx");
72+
.AddScript("~/js/Sample.jsx");
7373
});
7474

7575
// Add static files to the request pipeline.

0 commit comments

Comments
 (0)