【问题标题】:browser-sync not working with single page application浏览器同步不适用于单页应用程序
【发布时间】:2016-12-19 23:18:39
【问题描述】:

我有一个不使用哈希 URL 的单页应用程序我想使用历史 API。我在 browserSync 服务器选项中使用中间件 historyApiFallback()。但是,这仅适用于一级深层 URL:

http://localhost:3000/main 正确解析为 index.html 但 http://localhost:3000/main/a 不工作。浏览器显示“已连接到浏览器同步”,然后显示一个空白页面。

有人知道这里可能是什么问题吗?

【问题讨论】:

    标签: single-page-application browser-sync gulp-browser-sync


    【解决方案1】:

    问题在于 js 和 css 资源的 URL 设置不正确。这篇文章帮助我解决了这个问题:mod_rewrite to index.html breaks relative paths for deep URLs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-09
      • 2019-11-09
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 2022-01-04
      • 2017-04-26
      相关资源
      最近更新 更多