Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: router url join is invalid in Windows #4265

Merged
merged 7 commits into from
Apr 28, 2021
Merged

Conversation

luhc228
Copy link
Collaborator

@luhc228 luhc228 commented Apr 25, 2021

Closed: #4238

问题

  1. path.join() 在 Windows 系统下的路径拼接的结果如下面的例子所示:
path.join('/', '/about')
// 输出
// '\\about'

这样的路由很明显是不存在的,导致 SSR 渲染时找不到对应要渲染的页面。我们期望拼接后的路由是 /about

  1. 运行时的代码不应该使用 node 里面的 path 模块

解决

参考 url-join 代码实现一套路由路径拼接的方法

@ClarkXia
Copy link
Collaborator

另外路由 path 存在 /:id 这种设置,通过 url-join 处理感觉也不太对

@ClarkXia ClarkXia mentioned this pull request Apr 28, 2021
5 tasks
@luhc228 luhc228 merged commit ba7d38b into release-next Apr 28, 2021
@delete-merged-branch delete-merged-branch bot deleted the fix/router-url-join branch April 28, 2021 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants