-
Notifications
You must be signed in to change notification settings - Fork 70
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
refactor: ssr html load #607
Conversation
SoloJiang
commented
Feb 4, 2021
- 新增轻量版 cheerio
- 移除 SSR 运行时对 node 环境的依赖
@@ -11,7 +11,7 @@ export default (useRunApp) => { | |||
const raxServerRenderer = require('rax-app-renderer/lib/server').default; | |||
const { req, res } = ctx; | |||
const search = req.search; | |||
const parsedQuery = qs.parse(search); | |||
const parsedQuery = parseSearch(search); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法的依赖需要在当前文件引入吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个方法没有依赖,它的实现就在 loader 里
this.root.insertAfter(scripts); | ||
} | ||
|
||
insertedMetas(): string[] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这些是不是都是 getXXX 的方法
@@ -47,7 +47,7 @@ export function insertCommonElements(staticConfig) { | |||
} | |||
|
|||
export function generateHtmlStructure(htmlStr, htmlInfo?: IHtmlInfo) { | |||
const $ = cheerio.load(htmlStr); | |||
const $ = cheerio.load(htmlStr, { decodeEntities: false }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
还依赖 cheerio 吗
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
依赖
chalk.red('ERR!'), | ||
chalk.magenta(msg), | ||
); | ||
function parseSearch (search) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这段是不是可以放到调用的地方一起