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

[Bug]: @babel/plugin-transform-modules-commonjs transform default import without scope rename check while there is import namespace specifier #15879

Closed
1 task done
dhlolo opened this issue Aug 21, 2023 · 2 comments · Fixed by #15898
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@dhlolo
Copy link
Contributor

dhlolo commented Aug 21, 2023

💻

  • Would you like to work on a fix?

How are you using Babel?

Programmatic API (babel.transform, babel.parse)

Input code

import * as e from "xxx/std-format";
import t from "xxx/std-format";

const Ws = (e) => {
  const  {
      amount,
    } = e;
  return {
    amount: t.price(amount, 100),
  };
};

Babel REPL link

Configuration file name

No response

Configuration

No response

Current and expected behavior

  • current:
    e.default.price caused error, as 'e' is same with the params of arrow function Ws.
  • expected:
    check and throw error, or regenrate a unique identifier name for the 'var e';

Environment

System:
OS: macOS 12.6.3
Binaries:
Node: 16.13.2 - /usr/local/bin/node
Yarn: 1.22.18 - /usr/local/bin/yarn
npm: 9.5.0 - /usr/local/bin/npm
npmPackages:
@babel/core: 7.22.10 => 7.22.10
@babel/plugin-transform-runtime: 7.22.10 => 7.22.10
@babel/preset-env: 7.22.10 => 7.22.10

Possible solution

No response

Additional context

No response

@babel-bot
Copy link
Collaborator

Hey @dhlolo! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite.

@dhlolo
Copy link
Contributor Author

dhlolo commented Aug 21, 2023

Found it was caused by rewriteLiveReferences in '@babel/helper-module-transforms/lib/rewrite-live-references'.

dhlolo added a commit to dhlolo/babel that referenced this issue Aug 27, 2023
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Dec 11, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
i: bug outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants