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

refactor: ssr html load #607

Merged
merged 9 commits into from
Feb 19, 2021
Merged

refactor: ssr html load #607

merged 9 commits into from
Feb 19, 2021

Conversation

SoloJiang
Copy link
Contributor

  • 新增轻量版 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);
Copy link
Contributor

@chenjun1011 chenjun1011 Feb 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个方法的依赖需要在当前文件引入吗

Copy link
Contributor Author

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[] {
Copy link
Contributor

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 });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

还依赖 cheerio 吗

Copy link
Contributor Author

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) {
Copy link
Contributor

@chenjun1011 chenjun1011 Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这段是不是可以放到调用的地方一起

@SoloJiang SoloJiang merged commit 52ff4ee into release-next Feb 19, 2021
@SoloJiang SoloJiang deleted the refactor/ssr-dep branch February 19, 2021 03:53
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