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

fix: renderHTML indexHTML.replace when appHTML with $ #389

Merged
merged 2 commits into from
Dec 26, 2023

Conversation

YunYouJun
Copy link
Contributor

Description

When $` in appHTML, indexHTML.replace (renderHTML) will result in an abnormal replacement.

Specifying a string as the replacement | MDN

image

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}`

Linked Issues

YunYouJun/valaxy#295

It can be reproduced in the vite-ssg examples.

<a href="https://github.com/antfu/vite-ssg" aria-label="Permalink to &quot;Usage `^`, `$`&quot;"></a>

Additional context

@antfu antfu merged commit f4ba468 into antfu-collective:main Dec 26, 2023
8 checks passed
@YunYouJun YunYouJun deleted the yyj/fix-renderHTML branch December 27, 2023 03:30
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.

2 participants