1000 B
1000 B
WebDrop.Frontend
独立的 ASP.NET Core 模块,负责提供嵌入程序集的 Vite 前端资源。
构建
如果 web/dist/index.html 存在,项目会将 web/dist 作为 embedded resources 编入 WebDrop.Frontend.dll。也可通过 MSBuild 属性指定资源目录:
dotnet publish ..\WebDrop.Api\WebDrop.Api.csproj -p:WebDropFrontendDist=C:\build\web-dist
Containerfile 会构建 web/,再把 dist 传给 .NET 发布阶段。EmbeddedFrontend.Map 只映射页面与静态文件,不依赖 WebDrop.Core 或存储层。
开发时可以不构建 dist,此时模块不映射页面路由;使用 npm run dev 配合 Vite API 代理。
路由与响应
/和未知的前端路由返回index.html,支持 React SPA 深层链接。/assets/*从程序集资源读取;缺失资源和/api/*返回 404。- 页面使用同源 CSP,并允许配置的 Cap API origin、WebSocket 与 Worker。
index.html不缓存;Viteassets/使用 immutable 缓存。