You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vanilla.js客户端路由+Webpack懒加载:资源因MIME类型不匹配被拦截

问题:Webpack懒加载+VanillaJS客户端路由在嵌套路由下直接访问失效

使用Webpack实现懒加载(绿色编码)后,Vanilla.js客户端路由在/blog/2这类嵌套路由上失效。通过带data-btnref="navlink"的按钮链接访问正常,但直接在浏览器地址栏输入地址会触发以下报错:

GET http://localhost:3000/blog/main8f1360562bd664fccb25.js [HTTP/1.1 404 Not Found 3ms]
The resource from “http://localhost:3000/blog/main8f1360562bd664fccb25.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
Loading failed for the

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.22 17:33:25