Fixes `path.resolve(false)` in `MIDDLEWARE_PATH` declaration.
还没有人认领这个 Issue。
评估
- 难度
- 1/5
- 预计耗时
- 1 小时以内
- 新手友好度
- 50/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- express, javascript, node.js
- 领域
- backend
调研方向
从 index.js 中 MIDDLEWARE_PATH 的声明开始,将当前对 process.argv[3] 的处理与 issue 提供的 diff 进行比较。如果可用,复现 backstop 远程 middleware 的情况,然后验证不提供 middleware path 启动时仍能正常工作,并且提供的 path 会被解析,而不会将 false 传递给 path.resolve。
由索引模型根据 Issue 内容生成。
描述
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch [email protected] for the project I'm working on.
While debugging backstop remote I came across an issue with the middleware arg here. path.resolve doesn't accept booleans, so this splits the declaration of MIDDLEWARE_PATH into a ternary instead.
Hope this helps. Thanks for all you do!
Here is the diff that solved my problem:
diff --git a/node_modules/super-simple-web-server/index.js b/node_modules/super-simple-web-server/index.js
index 1eb8065..a27c9b9 100644
--- a/node_modules/super-simple-web-server/index.js
+++ b/node_modules/super-simple-web-server/index.js
@@ -34,7 +34,7 @@ function logger(req, res, next) {
* To add middleware set the third arg to a path that resolves to a file exporting a function like so...
* module.exports = (app) => { app.use(someCoolThingHere);}
*/
-const MIDDLEWARE_PATH = path.resolve(process.argv[3] || false);
+const MIDDLEWARE_PATH = process.argv[3] ? path.resolve(process.argv[3]) : false;
if (MIDDLEWARE_PATH) {
try {
var initMiddleware = require(MIDDLEWARE_PATH);
This issue body was partially generated by patch-package.
- 主要语言
- JavaScript
- 星标
- 0
- 派生
- 2
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 66/100
-
难度 1/5 1 小时以内 新手友好度 88/100
openlayers/create-ol-app#70 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 78/100
VoteIT/voteit_frontend#446 ·
-
难度 2/5 1-3 小时 新手友好度 78/100
simstudioai/sim#9831 ·
维护者通常 1 天内回复