Commit 9bf932c0 authored by Niklas Mischkulnig's avatar Niklas Mischkulnig Committed by Luke Sandberg

Turbopack: fix scope hoisting variable renaming bug (#81640)

parent 6d0ffcc7
......@@ -2062,7 +2062,7 @@ fn hygiene_rename_only(
}
// Copied from `hygiene_with_config`'s HygieneRenamer, but added an `preserved_exports`
impl swc_core::ecma::transforms::base::rename::Renamer for HygieneRenamer<'_> {
type Target = Atom;
type Target = Id;
const MANGLE: bool = false;
const RESET_N: bool = true;
......@@ -2081,7 +2081,7 @@ fn hygiene_rename_only(
self.preserved_exports.contains(orig) || orig.1.has_mark(self.is_import_mark)
}
}
swc_core::ecma::transforms::base::rename::renamer(
swc_core::ecma::transforms::base::rename::renamer_keep_contexts(
swc_core::ecma::transforms::base::hygiene::Config {
top_level_mark: top_level_mark.unwrap_or_default(),
..Default::default()
......
import { foo } from './internal/index.js'
it('should correctly rename imports', () => {
expect(foo({})).toBe(true)
})
import './patch-other.js'
import { patch as patch2 } from './patch.js'
export const bar = (patch) => patch + 1
export const foo = (patch) => patch !== patch2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment