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

swc helpers name collision #8451

Closed
shredor opened this issue Dec 22, 2023 · 3 comments · Fixed by #8456
Closed

swc helpers name collision #8451

shredor opened this issue Dec 22, 2023 · 3 comments · Fixed by #8456
Labels
Milestone

Comments

@shredor
Copy link

shredor commented Dec 22, 2023

Describe the bug

Naming collision with swc _define_property helper if there's _define_property variable and eval in source code

Input code

const a = () => {
  const _define_property = 1;
  const fn = () => console.log({ [prop]: 'test' });
};

const b = () => eval('console.log()');

Config

{
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "dynamicImport": true,
      "tsx": true,
      "jsx": true
    },
    "loose": false,
    "externalHelpers": true
  },
  "env": {
    "targets": "> 0.25%, not dead, Safari >=8",
    "mode": "entry",
    "coreJs": "3.27",
    "loose": false,
    "bugfixes": true
  }
}

Playground link (or link to the minimal reproduction)

https://play.swc.rs/?version=1.3.101&code=H4sIAAAAAAAAA0vOzysuUUhUsFXQ0FSwtVOo5lJQSAaLxaekpmXmpcYXFOUXpBaVVAKVGFrDZdPy4FpAAvk5qXo5%2Beka1QrRIPWxVgrqJanFJeoKtZrWXLXWXFwQXUlwTalliTka6shaNdWBSgGW9y1FjwAAAA%3D%3D&config=H4sIAAAAAAAAA32OzQ6CQAyE7z7Fpok3YgzGaEzkrF59ggrFQGB30y0GQnh3F%2BTHePDW%2BWbaTrtSCnIXw0m1fvTCIjviWXviGi1YewLSWHIxZ1YgmNyk0Vhm8bW0hsWHhCuaTXH1L8pnNJDuY0BhjCNvpFi4MQxUC7HG4kKFJXbL2rAEpF9LbUF%2BkvQZiNR2E%2B7XgdJGVEKYBOqOKXKmovNxLA6lSfp3%2FohwM8HYMN2GG7tNeIA%2F1R7VM81q%2Bu606t71QI0DTQEAAA%3D%3D

SWC Info output

No response

Expected behavior

import { _ as _define_property } from "@swc/helpers/_/_define_property";
var a = function() {
    var _define_property1 = 1;
    var fn = function() {
        return console.log(_define_property({}, prop, "test"));
    };
};

var b = function() {
    return eval("console.log()");
};

Actual behavior

import { _ as _define_property1 } from "@swc/helpers/_/_define_property";
var a = function() {
    var _define_property1 = 1;
    var fn1 = function() {
        return console.log(_define_property1({}, prop, "test"));
    };
};
var b = function() {
    return eval("console.log()");
};

Version

1.3.101

Additional context

No response

@shredor shredor added the C-bug label Dec 22, 2023
@kdy1 kdy1 added this to the Planned milestone Dec 23, 2023
@Austaras
Copy link
Member

Duplicate of #8185?

@Austaras
Copy link
Member

No. It's different.

@Austaras Austaras reopened this Dec 28, 2023
kdy1 pushed a commit that referenced this issue Dec 28, 2023
**Related issue:**

 - Closes #8451.
 - Closes #8185.
@kdy1 kdy1 modified the milestones: Planned, v1.3.102 Dec 31, 2023
@swc-bot
Copy link
Collaborator

swc-bot commented Jan 30, 2024

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Jan 30, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

4 participants