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
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.