首页 > 解决方案 > Vue CLI 3 和 Laravel 之间的 PWA 配置中的 URL 错误

问题描述

我有一个将 vue cli(使用 vue 2)和 laravel 7 与 vue.config.js 结合起来的项目,如下所示

module.exports = {
  devServer: {
    open: true,
    overlay: true,
    proxy: 'https://myapp.test'
  },

  outputDir: '../public/assets/app',

  publicPath: process.env.NODE_ENV === 'production'
    ? '/assets/app/'
    : '/',

  // modify the location of the generated HTML file.
  // make sure to do this only in production.
  indexPath: process.env.NODE_ENV === 'production'
    ? '../../../resources/views/app.blade.php'
    : 'index.html'

}

构建工作正常,但加载页面时出现此错误

Uncaught (in promise) bad-precaching-response: bad-precaching-response :: [{"url":"https://myapp.test/assets/app/index.html?__WB_REVISION__=bd0b9edc434ef6ad9c55783d10fbbffe","status":404}]

我已经浏览了 PWA 的文档,但我找不到可以自定义/指示正确 url 的位置,因为我在该路径中没有 index.html。

标签: laravelvue.jsvue-cli

解决方案


推荐阅读