Skip to content

Commit fe91fdf

Browse files
authored
fix: replaceIdentifiersInAst takes an expression, not a string (#79196)
missed this one in #78916. Weirdly enough the replacement seems to be working fine -- i guess something in recast was parsing the string (i.e. `path.replace("__turbopack_load_by_url__")` worked somehow). but that's not allowed according to recast's types, so we shouldn't rely on that.
1 parent aa96aa9 commit fe91fdf

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/next/taskfile.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,12 @@ export async function copy_vendor_react(task_) {
19351935
const ast = parseFile(source, { sourceFileName: filepath })
19361936
replaceIdentifiersInAst(
19371937
ast,
1938-
new Map([['__turbopack_load__', '__turbopack_load_by_url__']])
1938+
new Map([
1939+
[
1940+
'__turbopack_load__',
1941+
parseExpression('__turbopack_load_by_url__'),
1942+
],
1943+
])
19391944
)
19401945
file.data = recast.print(ast).code
19411946
} else if (

0 commit comments

Comments
 (0)