behavior of static and historyApiFallback

未關閉
#2,716 5 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

  • #5149 來自 @Swapnilden —— 已關閉,未合併

評估

難度
5/5
預估耗時
一週以上
新手友好度
25/100
Issue 類型
重構
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
express, javascript, webpack
領域
backend, devtools

研究方向

閱讀關於 pull request 2670 的連結討論,並檢查 lib/Server.js 第 548–559 行附近新增 middleware 功能的位置。接著追蹤靜態服務和 historyApiFallback 的設定方式,並考量 issue 中描述的相容性與效能權衡。完成的標準是找出一種只套用一次 middleware 的方法,或記錄一次有意進行的破壞性變更及其影響。

由索引模型根據 Issue 內容生成。

描述

scope: server semver: patch severity: 5 (confusing) type: feature type: refactor
Expected Behavior

Static serving middleware for the dev server should only need to be applied to the express server once via this.app.use(...)

Actual Behavior

static middleware is applied to the express server multiple times in order to make historyApiFallback work as expected. This is explained here: https://github.com/webpack/webpack-dev-server/pull/2670#discussion_r464946541

A similar thing seems to have been added for the middleware feature as seen here, as it is added multiple times:

https://github.com/webpack/webpack-dev-server/blob/4ab1f21bc85cc1695255c739160ad00dc14375f1/lib/Server.js#L548-L559

Solution

We need to find a way to either apply all of this middleware once without having any breaking changes, or have intentional slight breaking changes while only applying the middleware once. We should also look into if applying the same middleware many times causes performance losses, or if it is an acceptable thing to do.

主要語言
JavaScript
星號
7.9k
分支
1.5k
平均合併
2 天 12 小時
30 天內合併 PR
8

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

webpack/webpack-dev-server 的其他 Issue

查看 webpack/webpack-dev-server 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。