Using ASP.NET CORE 3.1 to host and serve everything. "index.html" is not intended to be accessed directly, "/app" hits an endpoint in .net core that serves the index.html file
Problems:
So, the root problem has to do with the app running at /app instead of /, and potentially having all of my assets at /dist/assets instead of /.
I need the PWA to be installable from my landing page, located at /, but the start_url would ideally be "/app", but as long as it is the index.html file that is fine
Is there any configuration changes I could make, or any .net core changes I could make, to support this?
Also, I did not install the pwa with a basehref parameter if that matters.
I figured it out.
[
'/**',
'!/**/*.*',
'!/**/*__*',
'!/**/*__*/**',
]
public static void Execute()
{
Log.Info("Configuring ngsw.json");
var ngsw = System.IO.File.ReadAllText($"{DeploySettings.SourcePath}wwwroot/dist/assets/ngsw.json");
var ngswJson = JObject.Parse(ngsw);
var toMerge = JObject.Parse(@"{
""navigationUrls"":[
{
""positive"": false,
""regex"": ""^.*Home.*$""
}
]}");
ngswJson.Merge(toMerge);
var json = ngswJson.ToString();
System.IO.File.WriteAllText($"{DeploySettings.SourcePath}wwwroot/dist/assets/ngsw.json", json);
}
At this point, I just have to figure out how to exclude my landing page and we'll be good. My app works offline finally!