Prerender: regexp capturing group replaces any instance of $1 (etc.)
danielweck opened this issue · 2 comments
danielweck commented
Ouch! When the string $1
occurs anywhere in headHtml
or body
... every instance of $1
gets replaced by the captured group:
wmr/packages/wmr/src/lib/prerender.js
Line 214 in 11663db
wmr/packages/wmr/src/lib/prerender.js
Line 217 in 11663db
I realised this when I injected hydration data into the HTML head, luckily so far none of my pre-rendered webpages' body
markup contained $1
:)
danielweck commented
My current workaround: str.replace(/\$1/g, '$')
works for result.html
but fails for result.data
as the escaped sequence doesn't actually get decoded by the browser.
developit commented
ah, good catch!