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.61k stars 284 forks source link

help::如何实现类似next.js配置项里rewrites的功能 #263

Closed where-picturesque closed 1 year ago

where-picturesque commented 1 year ago

详细描述你的问题

项目前端页面级组件目录是/web/pages/mobile;/web/pages/pc

原项目对应的访问路径是 /mobile/xx;/xx

期望的结果

不想给访问地址增加‘/pc’前缀,怎么处理可以使非/mobile开头的路径,渲染/pc文件夹下对应的页面,同时保证服务端渲染正常;类似next.js里 next.config.js rewrites的功能

zhangyuang commented 1 year ago

手动写routes文件或者使用http://doc.ssr-fc.com/docs/features$faq#%E5%8A%A8%E6%80%81%E8%B7%AF%E7%94%B1%E5%89%8D%E7%BC%80

where-picturesque commented 1 year ago

感谢

jarvi07 commented 2 months ago

不支持虚拟路由吗 按照示例配置,访问始终404,想实现的效果,例如已经配置实现访问xxx.com/channel/ID, 想实现的效果,访问xxx.com/channel_ID或访问 xxx.com/channel-ID 达到同样效果

// web/route.ts export const FeRoutes = [ { fetch: async () => await import(/ webpackChunkName: "channel-id-under-fetch" / '@/pages/channel/fetch'), path: '/channel_:id', component: async () => await import(/ webpackChunkName: "channel-id-under" / '@/pages/channel/render$id.vue'), webpackChunkName: 'channel-id-under' }, { fetch: async () => await import(/ webpackChunkName: "channel-id-bar-fetch" / '@/pages/channel/fetch'), path: '/channel-:id', component: async () => await import(/ webpackChunkName: "channel-id-bar" / '@/pages/channel/render$id.vue'), webpackChunkName: 'channel-id-bar' } ]

zhangyuang commented 2 months ago

没有配置服务端router

jarvi07 commented 2 months ago

哦哦 QQ_1724052374139 感谢 感谢 可以了