diff --git a/src/hook-inline.ts b/src/hook-inline.ts index 913c2af..3bf3d2b 100644 --- a/src/hook-inline.ts +++ b/src/hook-inline.ts @@ -6,7 +6,7 @@ import { SandboxOptions } from "./sandpack"; const escapeHTMLComment = (content: string) => { // It will be restored when parsing comment // to avoid break --> - return content.replaceAll("", "\\u002d\\u002d\\u003e"); + return content.split("").join("\\u002d\\u002d\\u003e"); }; export const inlineFiles = (content: string, filePath: string) => { const baseDir = path.dirname(filePath); diff --git a/src/parse-comment.ts b/src/parse-comment.ts index 4587aae..746ecd7 100644 --- a/src/parse-comment.ts +++ b/src/parse-comment.ts @@ -18,8 +18,10 @@ Actual: ${comment} try { const json = JSON.parse( optionString[1] - .replaceAll("\\\\u003c\\\\u0021\\\\u002d\\\\u002d", "") + .split("\\\\u003c\\\\u0021\\\\u002d\\\\u002d") + .join("") ); return { ...json