我剛剛將我的 Angular (8) 專案部署到 Google App Engine,有時我的網站會加載,有時我會遇到這個錯誤: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.我無法弄清楚為什么它看起來很好然后放棄的模式是什么。
這些檔案出現錯誤訊息:
runtime-es2015.cdfb0ddb511f65fdc0a0.jspolyfills-es2015.ffa9bb4e015925544f91.jsmain-es2015.10e52dfadb49c8bec6fe.js
如果它是相關的,當我加載它時,我遇到了與此問題類似的問題,即登錄頁面以外的頁面在重繪 時不會重新加載。
我的 app.yaml:
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /(.*)
static_files: dist/build/index.html
upload: dist/build/index.html
- url: /
static_dir: dist/build
- url: /(.*\.js)$
secure: always
static_files: dist/build/\1
upload: dist/build/.*\.js$
mime_type: application/javascript
skip_files:
- e2e/
- node_modules/
- src/
- coverage
- ^(.*/)?\..*$
- ^(.*/)?.*\.json$
- ^(.*/)?.*\.md$
- ^(.*/)?.*\.yaml$
- ^LICENSE
有任何想法嗎?
uj5u.com熱心網友回復:
如果您的應用程式使用更多,請嘗試在第一個處理程式中洗掉然后添加檔案擴展mime_type: application/javascript名。app.yaml
示例 app.yaml:
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /(.*\.(gif|png|jpg|less|json|woff|woff2|ttf|eot|scss|css|js|ico|svg)(|\.map))$
static_files: dist/build/index.html
upload: dist/build/index.html
- url: /(.*)
static_files: dist/index.html
upload: dist/index.html
skip_files:
- e2e/
- node_modules/
- src/
- coverage
- ^(.*/)?\..*$
- ^(.*/)?.*\.json$
- ^(.*/)?.*\.md$
- ^(.*/)?.*\.yaml$
- ^LICENSE
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/439030.html
標籤:javascript 有角度的 谷歌应用引擎 yaml
