admin管理员组

文章数量:1123260

I have an issue related to this question: Azure Static Web App returns incorrect MIME type for CSS and JS files (text/html).

I re-implemented the solution according to Aslesha Kantamsetti's response. However, I'm encountering a new problem related to the /profile/ path.

Current Deployed Directory Structure

Here's how my deployed directory looks:

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

The hostedPages part is working correctly with the staticwebapp.config.json file. Its behavior is as expected, and everything renders properly. Path: xyz/identity/login

The Issue

The issue occurs when I try to redirect to /profile/. The following error messages appear

Paht: xyz/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:6Understand this errorAI
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.Understand this errorAI
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.Understand this errorAI
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.Understand this errorAI
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.Understand this errorAI
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.

What I've Tried

  1. I verified that the staticwebapp.config.json is correctly placed in the root directory (dist/app/).
  2. The /profile/ directory contains its own index.html and related assets, as seen in the directory structure.
  3. I have also merged the deployment directories correctly, ensuring the structure matches the expected output.

Observations

  • The hostedPages part behaves as intended.
  • The /profile/ part returns errors, suggesting that the MIME type issue persists for CSS and JS files in the /profile/ route.

Request

Has anyone faced a similar issue with Azure Static Web Apps where different parts of the application behave inconsistently? Any pointers or suggestions would be greatly appreciated!

本文标签: angularAzure Static Web App returns incorrect MIME type for CSS and JS filesStack Overflow