【问题标题】:JS file in root not loading in Google Appengine根目录中的 JS 文件未在 Google Appengine 中加载
【发布时间】:2017-11-14 01:43:58
【问题描述】:

我正在 Google Appengine 中添加一个服务工作者。根据文档,sw.js 必须与调用它的 HTML 文件位于同一文件夹中。

我将以下内容添加到我的 app.yaml 文件中,但对于 sw.js 文件,我仍然收到 404 Not Found:

- url: /(index|sw)\.js$
  static_files: \1
  upload: (index|sw)\.js$
  application_readable: true

我在regex101.com 中测试了我的正则表达式,所以我知道这是正确的。

我认为声明的其余部分有问题。

【问题讨论】:

    标签: regex google-app-engine yaml service-worker


    【解决方案1】:

    您的正则表达式省略了 static_files 文件中的扩展名。试试:

    - url: /(index|sw)\.js$
      static_files: \1.js
      upload: (index|sw)\.js
      application_readable: true
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-09-24
      • 2017-09-26
      • 1970-01-01
      相关资源
      最近更新 更多