Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should not transform identifiers with binding #81

Closed
inottn opened this issue Apr 19, 2023 · 0 comments · Fixed by #82
Closed

should not transform identifiers with binding #81

inottn opened this issue Apr 19, 2023 · 0 comments · Fixed by #82

Comments

@inottn
Copy link
Contributor

inottn commented Apr 19, 2023

Here is a babel config:

module.exports = {
  plugins: [["transform-define", { TEST: "replaced" }]],
};

Transform the code below:

console.log(TEST); // should be transformed
function fn() {
  let TEST = "test"; // should not be transformed
  console.log(TEST); // should not be transformed
}

Currently, will be transformed into:

console.log("replaced");
function fn() {
  let "replaced" = "test"; // an error will be thrown here
  console.log("replaced");
}

Similar to #69 , an error will be thrown.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant