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 摘要。