Skip to content

parser: add warnings to pure annotations which parser is not able to interpret #20334

@h-a-n-a

Description

@h-a-n-a

It's good to have warnings in some scenario where pure annotations are not able
to be interpreted due to the position of the comment.

For example, pure annotation in the example down below is not able
to be interpreted due to position and it's ignored by the parser.

/* #__PURE__ */ React.createElement;

whereas, rollup would emit this warning to help people adjust the placement of pure annotation.

Rollup completed with warnings:
main.js (1:0): A comment "/* #__PURE__ */" in "main.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues. [(link)](https://rollupjs.org/configuration-options/#pure)
/main.js (1:0)
1: /* #__PURE__ */ React.createElement;

https://rollupjs.org/repl/?version=4.59.0&shareable=eyJleGFtcGxlIjpudWxsLCJtb2R1bGVzIjpbeyJjb2RlIjoiLyogI19fUFVSRV9fICovIFJlYWN0LmNyZWF0ZUVsZW1lbnQ7IiwiaXNFbnRyeSI6dHJ1ZSwibmFtZSI6Im1haW4uanMifV0sIm9wdGlvbnMiOnt9fQ==

Metadata

Metadata

Assignees

Labels

Priority

None yet

Start date

None yet

Target date

None yet

Effort

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions