Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to disable esbuild direct-eval warning

In one of my apps I need the eval function. I search and can’t something to replace it. When I upgrade to Angular 19, I have the following Warning in the build-watch and build-prod :

▲ [WARNING] Using direct eval with a bundler is not recommended and may cause problems [direct-eval]

src/frontend/app/statistics/statistics.component.ts:554:14:
      554 │               eval(option['function'] + '(' + cpt + ')');
          ╵               ~~~~

  You can read more about direct eval and bundling here: https://esbuild.github.io/link/direct-eval

Where can I disable this warning ? I didn’t find any esbuild config (like eslint) or something

Thanks

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Could you try replacing the eval expression with something like:

this[option['function']](cpt)

we get the string expression from option['function'] which would be a function on this and execute it with the cpt argument.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading