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

Parcel 2 incorrectly builds react-virtuoso with --no-scope-hoist #9198

Closed
kh-zowie opened this issue Aug 16, 2023 · 2 comments · Fixed by #9200
Closed

Parcel 2 incorrectly builds react-virtuoso with --no-scope-hoist #9198

kh-zowie opened this issue Aug 16, 2023 · 2 comments · Fixed by #9200

Comments

@kh-zowie
Copy link

kh-zowie commented Aug 16, 2023

🐛 bug report

I'm trying to use react-virtuoso library in my project, but unfortunately Parcel produces invalid build output and it does not work. Here is the input code sample from react-virtuoso libraries output:

const listSystem = system(
  ([
    {
      totalCount,
      sizeRanges,
      fixedItemSize,
      defaultItemSize,
      trackItemSizes,
      itemSize,
      data,
      firstItemIndex,
      groupIndices,
      statefulTotalCount,
      gap
    },
    { initialTopMostItemIndex, scrolledToInitialItem },
    domIO,
    followOutput,
    { listState, topItemsIndexes, ...flags },
    { scrollToIndex },
    _,
    { topItemCount },
    { groupCounts },
    featureGroup1,
    log
  ]) => {
...
})

Building above code in my project, Parcel produces:

var listSystem = system(function(param) {
    var _param = (0, _slicedToArray._)(param, 11), _param1 = _param[0], _param1 = _param[1], domIO = _param[2], followOutput = _param[3], _param1 = _param[4], _param1 = _param[5], _ = _param[6], _param1 = _param[7], _param1 = _param[8], featureGroup1 = _param[9], log = _param[10];
 ...

Look like Parcel incorrectly handles destructuring assignment here and produces multiple "_param1" (we can see above that e.g. domIO, followOutput are correct in output).

🎛 Configuration (.babelrc, package.json, cli command)

Default configuration (no .parcelrc in project)

Optimization disabled to prove it's not an issue with optimization. Looks like it's an issue with --no-scope-hoist

❌ parcel build ./index.html --no-optimize --no-scope-hoist
✅ parcel build ./index.html --no-optimize
✅ parcel serve ./index.html

react-virtuoso >=4.0.0

🤔 Expected Behavior

Parcel should produce correct output with --no-scope-hoist

😯 Current Behavior

Output is produced as above and does not work properly.

💁 Possible Solution

Don't know

🔦 Context

❌ I tried to use also parcel 2.8.3, but no luck.
✅ I tried to use legacy Parcel 1 and code works.

💻 Code Sample

🌍 Your Environment

Software Version(s)
Parcel 2.9.3
Node 16.20.2
npm/Yarn 8.19.4/1.22.19
Operating System Ubuntu
@mischnic
Copy link
Member

See swc-project/swc#7776

@kh-zowie
Copy link
Author

Hi, are there any plans for the new version release with that fix?

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