静态资源未能加载,页面主体为空。
浏览器不允许 file:// 页面加载 ES Module 脚本,所以双击打开一定是白屏。
本项目是单页应用(SPA),必须通过 HTTP 访问。
在解压目录执行任意一条命令,然后访问 http://127.0.0.1:8080:
python -m http.server 8080 npx serve . npx vite preview --port 8080
Windows 用户可直接双击包内 _preview/preview.bat 一键启动。
常见原因与处理:
/softtool/):需要用子路径重新构建
npx vite build --base=/softtool/,否则 /assets/* 会请求到站点根。index.html,
而不是 dist/index.html。location / { try_files $uri $uri/ /index.html; }。按 F12 打开控制台,看 Network 里哪些请求是 404,即可定位具体路径。