Closed YunYouJun closed 9 months ago
When $` in appHTML, indexHTML.replace (renderHTML) will result in an abnormal replacement.
$`
appHTML
indexHTML.replace
Specifying a string as the replacement | MDN
https://github.com/antfu/vite-ssg/blob/8015d55b798fa9d5f3ebb7c79763ec7ad429a795/src/node/build.ts#L279-L283
In order for it not to be affected by special rules, we need to convert it into a function.
() => `<div id="${rootContainerId}" data-server-rendered="true">${appHTML}</div>${stateScript}`
https://github.com/YunYouJun/valaxy/issues/295
It can be reproduced in the vite-ssg examples.
<a href="https://github.com/antfu/vite-ssg" aria-label="Permalink to "Usage `^`, `$`""></a>
Description
When
$`
inappHTML
,indexHTML.replace
(renderHTML) will result in an abnormal replacement.https://github.com/antfu/vite-ssg/blob/8015d55b798fa9d5f3ebb7c79763ec7ad429a795/src/node/build.ts#L279-L283
In order for it not to be affected by special rules, we need to convert it into a function.
Linked Issues
https://github.com/YunYouJun/valaxy/issues/295
It can be reproduced in the vite-ssg examples.
Additional context