Skip to content

Commit a54748f

Browse files
authored
Merge pull request #213 from farwayer/backticks-fix
Fix backticks escaping
2 parents c61313c + 9ed8a54 commit a54748f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/plugin/index.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import type { BuildOptions } from "esbuild";
88
import { isEntryFile } from "./babel";
9-
import { RNRBConfig, bundle, escape } from "./bundler";
9+
import { RNRBConfig, bundle } from "./bundler";
1010
import { join } from "path";
1111

1212
const metroTransformer = (() => {
@@ -42,10 +42,7 @@ export const createTransformer = (
4242
const res = await bundle(filename, metroOptions, esbuildOptions);
4343
return metroTransformer.transform({
4444
...args,
45-
src:
46-
"export default String.raw`" +
47-
escape(res).replace(/\$/g, '\\$') +
48-
"`.replace(/\\\\([`$])/g, '\\$1')",
45+
src: "export default " + JSON.stringify(res),
4946
});
5047
}
5148

0 commit comments

Comments
 (0)