iT邦幫忙

1

azure static web app 部署問題

  • 分享至 

  • xImage

我有兩個前後端分離的專案,當我從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
  • deploy

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

圖片
  熱門推薦
圖片
{{ item.channelVendor }} | {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友回答

立即登入回答