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

Azure静态Web Apps中/profile/路径CSS/JS MIME类型异常求助

Azure静态Web应用/profile/路径资源MIME类型异常问题

此前遇到Azure静态Web应用返回CSS、JS文件错误MIME类型(text/html)的问题,按照相关方案调整后,新出现与/profile/路径相关的异常。

当前部署目录结构

部署目录结构如下:

dist/
└── app/
    ├── index.html
    ├── assets/ (hostedPages资源)
    ├── staticwebapp.config.json
    ├── profile/
    │   ├── index.html
    │   └── assets/ (profile页面资源)

通过staticwebapp.config.json配置,hostedPages相关页面(如xyz.com/identity/login)运行正常,页面渲染符合预期。

问题详情

访问xyz.com/profile/user-profile/路径时,出现以下错误:

util.js:179 Uncaught TypeError: Bootstrap's JavaScript requires jQuery. jQuery must be included before Bootstrap's JavaScript.
    at Object.jQueryDetection (util.js:179:13)
    at util.js:195:6
    at bootstrap.bundle.min.js:6:167
    at bootstrap.bundle.min.js:6:246
jQueryDetection @ util.js:179
(anonymous) @ util.js:195
(anonymous) @ bootstrap.bundle.min.js:6
(anonymous) @ bootstrap.bundle.min.js:6
runtime.397bdeab26062b41.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
polyfills.f2987581d2a3f7b2.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
main.54fb4a50bf63cb67.js:1 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
editprofile:1 Refused to execute script from 'https://xyz/scripts.475f59cc510f11ef.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
editprofile:1 Refused to apply style from 'https://xyz/styles.7a5458fde1f85a21.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

已尝试操作

  • 确认staticwebapp.config.json已正确放置在dist/app/根目录;
  • 确认/profile/目录包含独立的index.html及对应资源,目录结构匹配;
  • 已正确合并部署目录,结构符合预期。

观察结果

  • hostedPages相关页面运行正常;
  • /profile/路径下的CSS、JS文件仍存在MIME类型错误,导致资源加载失败。

请求帮助

是否有人遇到过Azure静态Web应用中不同页面路由表现不一致的类似问题?恳请提供解决建议或排查方向!

内容的提问来源于stack exchange,提问作者Adam

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 02:21:15