我有兩個前後端分離的專案,當我從A專案跳轉到B專案時,Console顯示錯誤:
Refused to apply style from 'https://巴拉巴拉我的網域/css/chunk-vendors.b029c8dc.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to apply style from 'https://巴拉巴拉我的網域/css/app.f07feabe.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
Refused to execute script from 'https://巴拉巴拉我的網域/js/chunk-vendors.f318a04e.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
Refused to execute script from 'https://巴拉巴拉我的網域/js/app.e3588d39.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
該怎麼解決呢?
附上
staticwebapp.config.json:
{
"platform": {},
"routes": [
{
"route": "/api/",
"rewrite": "https://巴拉巴拉我的網域/api/"
},
{
"route": "/",
"rewrite": "/index.html"
}
],
"navigationFallback": {
"rewrite": "/index.html",
"exclude": ["/api/", "/css/", "/js/", "/favicon.ico"]
}
}
.gitlab-ci.yml:
stages:
build:
stage: build
image: node:18
script:
- npm install
- npm run build
artifacts:
paths:
- dist/
only:
- master
deploy:
stage: deploy
image: node:18
script:
- npm install -g @azure/static-web-apps-cli
- 'swa deploy --app-location dist --deployment-token "$AZURE_STATIC_WEB_APPS_API_TOKEN" --env production --verbose'
dependencies:
- build
only:
- master