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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parcel breaks property access if property has same name as enclosing function #8102

Closed
danieltroger opened this issue May 18, 2022 · 0 comments 路 Fixed by #8121
Closed

Parcel breaks property access if property has same name as enclosing function #8102

danieltroger opened this issue May 18, 2022 · 0 comments 路 Fixed by #8121

Comments

@danieltroger
Copy link
Contributor

馃悰 bug report

Parcel breaks code where a property on an object is accessed that has the same name as an enclosing function. In that case the property name is transformed to something like $b5397e630a15ea24$export$6a5cdcad01c973fa.

馃帥 Configuration (.babelrc, package.json, cli command)

Please see attached .zip file

馃 Expected Behavior

!async function(){console.log({foo:"123"}?.foo)}(); -> logs "123" when ran

馃槸 Current Behavior

!async function(){console.log({foo:"123"}?.$38da3cfda514bd25$export$6a5cdcad01c973fa)}(); -> logs undefined when ran

馃拋 Possible Solution

Make so that the property name no longer gets replaced

馃敠 Context

Our code stopped working. Turns out this is why. Kudos to @carltheperson for debugging.

馃捇 Code Sample

parcel-broken-code.zip
run yarn install and then yarn build

foo();

export async function foo() {
  function bar() {
    return { foo: "123" }?.foo;
  }

  console.log(bar());
}

馃實 Your Environment

Software Version(s)
Parcel 2.0.0-nightly.1094+8981c8896
Node v18.0.0
npm/Yarn 3.2.1
Operating System macOS 12.2 (21D49)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants