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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the library with vite raises 3 warnings about the use of the eval method #419

Open
Ennoriel opened this issue Dec 20, 2024 · 0 comments

Comments

@Ennoriel
Copy link

Ennoriel commented Dec 20, 2024

When using the library with vite, vite raises 3 warnings about the use of the eval method

use:

import * as lib from "google-libphonenumber";

warnings (Use of eval in "..." is strongly discouraged as it poses security risks and may cause issues with minification):

node_modules/.pnpm/google-libphonenumber@3.2.40/node_modules/google-libphonenumber/dist/libphonenumber.js (38:206): Use of eval in "node_modules/.pnpm/google-libphonenumber@3.2.40/node_modules/google-libphonenumber/dist/libphonenumber.js" is strongly discouraged as it poses security risks and may cause issues with minification.
node_modules/.pnpm/google-libphonenumber@3.2.40/node_modules/google-libphonenumber/dist/libphonenumber.js (40:350): Use of eval in "node_modules/.pnpm/google-libphonenumber@3.2.40/node_modules/google-libphonenumber/dist/libphonenumber.js" is strongly discouraged as it poses security risks and may cause issues with minification.
node_modules/.pnpm/google-libphonenumber@3.2.40/node_modules/google-libphonenumber/dist/libphonenumber.js (56:475): Use of eval in "node_modules/.pnpm/google-libphonenumber@3.2.40/node_modules/google-libphonenumber/dist/libphonenumber.js" is strongly discouraged as it poses security risks and may cause issues with minification.

Here are the 3 lines:

goog.ASSUME_ES_MODULES_TRANSPILED=!1;goog.TRANSPILE_TO_LANGUAGE="";goog.TRANSPILER="transpile.js";goog.hasBadLetScoping=null;goog.useSafari10Workaround=function(){if(null==goog.hasBadLetScoping){try{var a=!eval('"use strict";let x = 1; function f() { return typeof x; };f() == "number";')}catch(b){a=!1}goog.hasBadLetScoping=a}return goog.hasBadLetScoping};goog.workaroundSafari10EvalBug=function(a){return"(function(){"+a+"\n;})();\n"};
goog.constructNamespace_(e,d,c!==d):goog.SEAL_MODULE_EXPORTS&&Object.seal&&"object"==typeof d&&null!=d&&Object.seal(d),goog.loadedModules_[e]={exports:d,type:goog.ModuleType.GOOG,moduleId:goog.moduleLoaderState_.moduleName};else throw Error('Invalid module name "'+e+'"');}finally{goog.moduleLoaderState_=b}};goog.loadModuleFromSource_=function(a,b){eval(b);return a};
a=b?[b]:a.getElementsByTagName("SCRIPT");for(b=a.length-1;0<=b;--b){var c=a[b].src,d=c.lastIndexOf("?");d=-1==d?c.length:d;if("base.js"==c.substr(d-7,7)){goog.basePath=c.substr(0,d-7);break}}}},goog.findBasePath_(),goog.Transpiler=function(){this.requiresTranspilation_=null;this.transpilationTarget_=goog.TRANSPILE_TO_LANGUAGE},goog.Transpiler.prototype.createRequiresTranspilation_=function(){function a(g,h){e?d[g]=!0:h()?(c=g,d[g]=!1):e=d[g]=!0}function b(g){try{return!!eval(g)}catch(h){return!1}}

These warnings seem to originate from the goog library but I cannot see it in the dependency tree of google-libphonenumber.

Do you have any idea of where that originates from?

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

1 participant