We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
npm init rax 选择 App (Build universal application) 选择 Web 单页应用 选择 JavaScript 修改app.js
npm init rax
App (Build universal application)
Web 单页应用
JavaScript
runApp({ router: { type: "browser", basename: "/testrouter" } });
npm i npm start
npm i
npm start
此时,访问 http://localhost:3333/testrouter 与 http://localhost:3333/, 都可以正常访问。
build.json 文件中加入ssr配置如下。
"web": { "ssr": true },
此时,重新npm start, 访问http://localhost:3333/ 正常。 但是,访问 http://localhost:3333/testrouter, 提示Cannot find target page.
期望结果:能够正常访问 http://localhost:3333/testrouter
{ "targets": [ "web" ], "web": { "ssr": true }, "plugins": [ "@ali/build-plugin-rax-app-def" ] }
The text was updated successfully, but these errors were encountered:
这个问题产生原因是,basename 是一个运行时配置,在 SSR 的时候去决定渲染哪个页面是根据 app.json 配置的 path 来确定的,所以实现上目前做不到将 ${basename}/${path} 去和 path 匹配找到对应需要渲染的组件,即 SSR 场景下无法支持配置 basename
basename
path
${basename}/${path}
Sorry, something went wrong.
理论上可以对请求路径做模糊匹配,只是会存在一定的不确定性,比如 app.json 中找不到 ${basename}/${path} => request.path.indexOf(path) > -1
request.path.indexOf(path) > -1
No branches or pull requests
npm init rax
选择
App (Build universal application)
选择
Web 单页应用
选择
JavaScript
修改app.js
npm i
npm start
此时,访问 http://localhost:3333/testrouter 与 http://localhost:3333/,
都可以正常访问。
build.json 文件中加入ssr配置如下。
此时,重新npm start,
访问http://localhost:3333/ 正常。
但是,访问 http://localhost:3333/testrouter, 提示Cannot find target page.
期望的结果是什么
期望结果:能够正常访问 http://localhost:3333/testrouter
相关环境信息
The text was updated successfully, but these errors were encountered: