Skip to content

Commit 46c9466

Browse files
committed
version: 2.0.9
1 parent 983aee9 commit 46c9466

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"name": "@umajs/plugin-react-ssr",
3-
"version": "2.0.8",
3+
"version": "2.0.9",
4+
"keywords": [
5+
"umajs",
6+
"umajs-plugin",
7+
"umajs-plugin-react",
8+
"umajs-plugin-react-ssr"],
49
"description": "In umajs, React is used to develop the plug-in of SPA and MPA, which supports server-side rendering and client-side rendering",
510
"author": "zunyi_zjj@163.com",
611
"license": "MIT",

src/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,15 @@ const renderDom = async (ctx:IContext, viewName:string, initProps?:any, options?
115115
}
116116

117117
// 在SSR模式中, 将__SSR_DATA_匹配出来, 避免其中内容被模板引擎执行, 避免注入类攻击
118-
const ssrReg = new RegExp(/<script[^>]*>window.__SSR_DATA__=([\s\S]*?)<\/script>/)
119-
const placeholderStr = '<!--plAcehoLder-->'
120-
const ssrScriptStr = html.match?.(ssrReg)?.[0] || ''
121-
const renderHtml = html.replace(ssrReg, placeholderStr) // without ssr script
118+
const ssrReg = new RegExp(/<script[^>]*>window.__SSR_DATA__=([\s\S]*?)<\/script>/);
119+
const placeholderStr = '<!--plAcehoLder-->';
120+
const ssrScriptStr = html.match?.(ssrReg)?.[0] || '';
121+
const renderHtml = html.replace(ssrReg, placeholderStr); // without ssr script
122122

123123
// engine rendering
124124
html = await engine.render(renderHtml, state);
125125
// final result
126-
html = html.replace(placeholderStr, ssrScriptStr)
126+
html = html.replace(placeholderStr, ssrScriptStr);
127127
}
128128

129129
return html;

0 commit comments

Comments
 (0)