mirror of
https://github.com/javascript-obfuscator/javascript-obfuscator
synced 2026-08-09 12:42:29 +00:00
Make Utils.nodeRequire lazy-evaluated to avoid ReferenceError in browser environments
This commit is contained in:
@@ -2,6 +2,7 @@ Change Log
|
||||
|
||||
v5.4.1
|
||||
---
|
||||
* Fixed `Utils.nodeRequire` causing `ReferenceError: require is not defined` in browser build by making it lazy-evaluated
|
||||
* Fixed missing space between keywords (`return`, `throw`, `typeof`) and Unicode surrogate pair identifiers in compact mode. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1112
|
||||
* Fixed `domainLock` being case-sensitive — domain values are now normalized to lowercase. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1182
|
||||
* Removed `source-map-support` runtime dependency. Use `node --enable-source-maps` instead. Fixes https://github.com/javascript-obfuscator/javascript-obfuscator/issues/1149
|
||||
|
||||
+4
-1
@@ -12,9 +12,12 @@ export class Utils {
|
||||
/**
|
||||
* Dynamic require that bypasses webpack bundling.
|
||||
* Use for Node.js-only modules that should not be included in the browser build.
|
||||
* Lazy-evaluated to avoid ReferenceError in browser environments.
|
||||
*/
|
||||
// eslint-disable-next-line no-eval
|
||||
public static readonly nodeRequire: NodeRequire = eval('require');
|
||||
public static get nodeRequire(): NodeRequire {
|
||||
return eval('require');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} version
|
||||
|
||||
Reference in New Issue
Block a user