I’m using ASP.Net core SPA with svelte kit static-adapter, when publish project, the wwwroot folder get generate by vite build command for app.UseDefaultFiles(); app.UseStaticFiles();
. Start the application and connect to top level urls like /[url], every things work fine, but when i access other url in sub directories like /[0]/[1], then error about import path happened (expect ‘../’ instead of ‘./’)
Error in Sub Directory File
But in wwwroot the content is correct
<link href="../_app/immutable/assets/0.BWQ_AXWl.css" rel="stylesheet">
<link rel="modulepreload" href="../_app/immutable/entry/start.DSATCu1-.js">
<link rel="modulepreload" href="../_app/immutable/chunks/entry.CbekV8Il.js">
<link rel="modulepreload" href="../_app/immutable/chunks/scheduler.DKwKPiiE.js">
Promise.all([
import("../_app/immutable/entry/start.DSATCu1-.js"),
import("../_app/immutable/entry/app.Beql58MK.js")
]).then(([kit, app]) => {...});
As I test, the content of wwwroot folder changed won’t affect what asp.net core response
There is my esproj of svetle project:
<Project Sdk="Microsoft.VisualStudio.JavaScript.Sdk/0.5.271090-alpha">
<PropertyGroup>
<StartupCommand>npm run dev</StartupCommand>
<BuildCommand>npm run build:staging_dev</BuildCommand>
<JavaScriptTestRoot>src</JavaScriptTestRoot>
<JavaScriptTestFramework>Jest</JavaScriptTestFramework>
<ShouldRunBuildScript>false</ShouldRunBuildScript>
<BuildOutputFolder>$(MSBuildProjectDirectory)build</BuildOutputFolder>
</PropertyGroup>
</Project>
And SPA properties group of host project:
<PropertyGroup>
<SpaRoot>....srcProject.Client</SpaRoot>
<SpaProxyLaunchCommand>npm run dev</SpaProxyLaunchCommand>
<SpaProxyServerUrl>http://localhost:5173</SpaProxyServerUrl>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="....srcProject.ClientProject.Client.esproj" >
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
How can i resolve this error? Or can someone explain me the behaviour of wwwroot folder in published application