zhangyuang / ssr

A most advanced ssr framework support React17/React18/Vue2/Vue3 on Earth that implemented serverless-side render specification.
http://doc.ssr-fc.com/
MIT License
2.59k stars 283 forks source link

fix: react router basename in server entry #212

Closed Phecda closed 2 years ago

Phecda commented 2 years ago

Keep same with csr mode

zhangyuang commented 2 years ago

这里不需要加basename吧 上一步用来匹配的url已经是replace prefix的结果了

发自我的iPhone

------------------ Original ------------------ From: Phecda Su @.> Date: Wed,Jun 22,2022 10:50 AM To: zhangyuang/ssr @.> Cc: Subscribed @.***> Subject: Re: [zhangyuang/ssr] fix: react router basename in server entry (PR #212)

Keep same with csr mode

You can view, comment on, or merge this pull request online at:

  https://github.com/zhangyuang/ssr/pull/212

Commit Summary

e9dc1f7 fix: react router basename in server entry

File Changes

(1 file)

 M     packages/plugin-react/src/entry/server-entry.tsx     (2)    

Patch Links:

https://github.com/zhangyuang/ssr/pull/212.patch

https://github.com/zhangyuang/ssr/pull/212.diff

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Phecda commented 2 years ago

之前不含 prefix 的 path 只是用来搜寻 component 的;react router 用的是 ctx.request.url,这里还有prefix

zhangyuang commented 2 years ago

basename就是用来定位component的,现在已经能够定位了还要加basename的目的是啥

发自我的iPhone

------------------ Original ------------------ From: Phecda Su @.> Date: Wed,Jun 22,2022 10:57 AM To: zhangyuang/ssr @.> Cc: yuuang @.>, Comment @.> Subject: Re: [zhangyuang/ssr] fix: react router basename in server entry (PR #212)

之前不含 prefix 的 path 只是用来搜寻 component 的;react router 用的是 ctx.request.url,这里还有prefix

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Phecda commented 2 years ago

为了 useLocation 之类的 hook 在 ssr 和 csr 下给出统一结果。现在是不统一的

// https://www.example.com/zh-HK/about
// prefix: zh-HK
const location = useLocation();
console.log(location);

image