Island broken if prop contains the string `$'`
Closed this issue ยท 2 comments
ouuan commented
- I have read the troubleshooting section before opening an issue.
- I have tried upgrading
iles
andvite
.
Description ๐
If the prop of an island contains the string $'
, it will be broken in the production build.
Reproduction ๐
https://github.com/ouuan/iles-issue-224-reproduction
The production build output:
<div id="app"><ile-root id="ile-1"></ile-root><script></script><script type="module" async>import{h as o,c as a}from"/assets/iles.ad977ee4.js";import{_ as r}from"/assets/Foo.dc3d22a4.js";import"/assets/vendor-vue.c0787f6d.js";o(a,r,"ile-1",{foo:"</div>
</body>
</html>"},{});
</script></div>
The following snippet should be foo:"$'"
:
foo:"</div>
</body>
</html>"
ouuan commented
This is a weird issue. I accidentally discovered it because I wrote $'$
in my blog and the search page went broken.
ouuan commented
I found the bug.
iles/packages/iles/src/node/build/write.ts
Lines 52 to 55 in ed9c072
See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace#specifying_a_string_as_the_replacement. I only knew $1
, $2
before and this is the first time I hear of $&
, $`
and $'
.