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

rollup complains about the #__PURE__ annotations #66

Open
chase-moskal opened this issue Feb 9, 2024 · 1 comment
Open

rollup complains about the #__PURE__ annotations #66

chase-moskal opened this issue Feb 9, 2024 · 1 comment

Comments

@chase-moskal
Copy link

馃憢 hey, love the library, i've used it for years for many projects, it's my go-to!

i noticed rollup is complaining about the #__PURE__ comments -- glancing at rollup's docs, i think it just wants these annotations positioned before the const?

i suspect a change like this might make both uglify and rollup happy? i'm using terser, which apparently supports these same kinds of annotations.

- const F2 = /*#__PURE__*/ 0.5 * (Math.sqrt(3.0) - 1.0);
+ /*#__PURE__*/ const F2 = 0.5 * (Math.sqrt(3.0) - 1.0);

rollup's warning, literally complaining about the meta-comment // these #__PURE__ comments help uglifyjs with dead code removal which is kinda funny

(!) A comment

"// these #__PURE__ comments help uglifyjs with dead code removal"

in "../toolbox/node_modules/simplex-noise/dist/esm/simplex-noise.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
https://rollupjs.org/https://rollupjs.org/configuration-options/#pure
../toolbox/node_modules/simplex-noise/dist/esm/simplex-noise.js (29:0)
27:  SOFTWARE.
28:  */
29: // these #__PURE__ comments help uglifyjs with dead code removal
    ^
30: //
31: const F2 = /*#__PURE__*/ 0.5 * (Math.sqrt(3.0) - 1.0);

another rollup warning about the next line

(!) A comment

"/*#__PURE__*/"

in "../toolbox/node_modules/simplex-noise/dist/esm/simplex-noise.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.
https://rollupjs.org/https://rollupjs.org/configuration-options/#pure
../toolbox/node_modules/simplex-noise/dist/esm/simplex-noise.js (31:11)
29: // these #__PURE__ comments help uglifyjs with dead code removal
30: //
31: const F2 = /*#__PURE__*/ 0.5 * (Math.sqrt(3.0) - 1.0);
               ^
32: const G2 = /*#__PURE__*/ (3.0 - Math.sqrt(3.0)) / 6.0;
33: const F3 = 1.0 / 3.0;

this obviously is not a critical issue.

@jwagner
Copy link
Owner

jwagner commented Feb 9, 2024

馃憢 hey, love the library, i've used it for years for many projects, it's my go-to!

Thank you!

The next step here would be to run a quick experiment on what's needed with minifiers these days.

From a quick test with the terser REPL and uglifyjs it looks like

  const F2 =  0.5 * (/*#__PURE__*/Math.sqrt(3.0) - 1.0);

should work universally.

@chase-moskal
Is there any easy way to test whether this would also make rollup happy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants