-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[preserveAllComments
] Pure annotations are placed in the wrong position
#7735
Comments
preserveAllComments
] Pure annotations are placed in the wrong position
For me (using SWC as part of parcel) pure comments are not respected at all right now. Not sure if it's this issue or parcel-bundler/parcel#9111? EDIT: Some actually are but some are "eaten up" even when building with |
Describe the bug
SWC injects pure annotation right before the async polyfill call, however if async arrow function is been assigned, the PURE annotation appear in the wrong position.
Why does this matter
Because if Pure appears before the import statements, when this code is processed by webpack, if this module's dependencies are all concatenated, then the import statements are gone, and the code will be like this
As you can see the PURE annotation points that setSomeEffect call is pure which is not, and removes this call expression after minimization.
Input code
Config
Playground link
https://play.swc.rs/?version=1.3.71&code=H4sIAAAAAAAAAytOLQnOz011TUtLTS7R0OTi0tdXMDQy5krOzysuUUhUsFVILK7MS1bQ0FSwtVOo5qq15uJKK81LLsnMz1MoykzPKAnISUxOBUpXcykAAVQ7iImqESQC1FwLAKBlQRFxAAAA&config=H4sIAAAAAAAAA12NwQqDQAxE737FkrNXL95KL%2F2NRQaxrNslGUUR%2F72xUqG9JW8mL1sVgjytkzZsPvqChdAc0wOpQM0D6oT6DEtUg15lJ7Tlp%2BLI1sx4UOFaYJ0OhXKm%2B9ejcM%2BMW0r31zgi8%2B8Ro%2Fbg4YA1Un0u9zcWcwxJrQAAAA%3D%3D
Expected behavior
Pure annotation should appear inside the assignment expr, like the one inside rightPlace function body
Actual behavior
Pure annotation appears at the top of the module
Version
1.3.71
Additional context
No response
The text was updated successfully, but these errors were encountered: