react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Rollup warnings

Open vovsemenv opened this issue 1 year ago โ€ข 8 comments

Provide a general summary of the issue here

when i build with [email protected] i get this warnings

"/*#__PURE__*/"

in "node_modules/react-aria-components/dist/Breadcrumbs.mjs" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
node_modules/react-aria-components/dist/ComboBox.mjs (49:42): A comment

"/*#__PURE__*/"

in "node_modules/react-aria-components/dist/ComboBox.mjs" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.

๐Ÿค” Expected Behavior?

no warnings

๐Ÿ˜ฏ Current Behavior

warnings

๐Ÿ’ Possible Solution

No response

๐Ÿ”ฆ Context

No response

๐Ÿ–ฅ๏ธ Steps to Reproduce

Version

1.3.1

What browsers are you seeing the problem on?

Other

If other, please specify.

No response

What operating system are you using?

macos

๐Ÿงข Your Company/Team

No response

๐Ÿ•ท Tracking Issue

No response

vovsemenv avatar Aug 23 '24 08:08 vovsemenv

Sounds like a rollup or vite issue? have you checked their repos for that error or any bugs around it?

Otherwise, we'd need to know more about why it's thinking that it's invalid https://rollupjs.org/configuration-options/#pure but nothing is jumping out at me, other than I'm not actually sure what is generating the annotation. That's just a provider from a createContext call, so possibly React is generating it. Could check React and babel's docs to see if they have any bugs as well.

For reference, this the file and the Pure annotation is on line 49 https://www.unpkg.com/browse/[email protected]/dist/ComboBox.mjs

snowystinger avatar Aug 26 '24 01:08 snowystinger

Something jumping out to me is the fact that examples show the comment placed before a statement, not in the middle of it like the ComboBox generated code.

synecdokey avatar Aug 27 '24 16:08 synecdokey

Any fix for this ?

hosenur avatar Sep 08 '24 01:09 hosenur

Not yet, someone will need to figure out if the PURE annotation is actually a bug in rollup or if it's a bug in our transpiled code first.

snowystinger avatar Sep 09 '24 00:09 snowystinger

The createElement function is what should be marked with the /*#__PURE__*/ annotation. It appears the annotation is being misplaced due to the transform of the nullish coalescing operator.

I was able to recreate the issue in a simplified Parcel REPL.

While the solution appears to depend on one of the upstream libraries, doing either of these things seems to fix the issue:

  • Ditch the nullish coalescing operator
  • Using an explicit return instead of implicit in the arrow operator

matt-aaron avatar Sep 09 '24 20:09 matt-aaron

Thanks for providing the reproduction, we'll definitely want to get that fixed. I've opened the bug in Parcel as well https://github.com/parcel-bundler/parcel/issues/9947

In the meantime, patching such as patch-package should be able to help users work around the problem.

snowystinger avatar Sep 09 '24 22:09 snowystinger

Hi, FYI I am having the same issue with the pure comments in this file:

https://www.unpkg.com/browse/[email protected]/dist/Breadcrumbs.mjs

felixwaldbach avatar Sep 20 '24 12:09 felixwaldbach

Looks like it's fixed in Parcel. https://github.com/parcel-bundler/parcel/issues/9947#event-14448749509 When we update this should be resolved.

snowystinger avatar Sep 30 '24 23:09 snowystinger

I'm still getting this warning with vite 5.4.11 and react-aria-components 1.4.1.

happenslol avatar Nov 14 '24 20:11 happenslol