mirror of
https://github.com/protobufjs/protobuf.js.git
synced 2025-12-08 20:58:55 +00:00
fix: remove eval usage so that chrome extension MV3 can run properly (#1941)
This commit is contained in:
parent
547afa26f7
commit
f2ccb99922
@ -8,12 +8,17 @@ module.exports = inquire;
|
||||
* @returns {?Object} Required module if available and not empty, otherwise `null`
|
||||
*/
|
||||
function inquire(moduleName) {
|
||||
try {
|
||||
var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval
|
||||
if (mod && (mod.length || Object.keys(mod).length))
|
||||
return mod;
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
try {
|
||||
if (typeof require !== "function") {
|
||||
return null;
|
||||
}
|
||||
var mod = require(moduleName);
|
||||
if (mod && (mod.length || Object.keys(mod).length)) return mod;
|
||||
return null;
|
||||
} catch (err) {
|
||||
// ignore
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user