Docs
/
VM Obfuscation
/

Targeting Functions

Targeting Specific Functions

Recommended

For optimal performance, VM-obfuscate only your most sensitive code using vmTargetFunctionsMode.

Set vmTargetFunctionsMode: 'comment' to only VM-obfuscate functions decorated with a special comment. Works at any nesting level.

function regularFunction() {
    return 'not virtualized';
}

/* javascript-obfuscator:vm */
function sensitiveFunction() {
    return 'this will be VM-protected';
}

class MyClass {
    /* javascript-obfuscator:vm */
    sensitiveMethod() {
        return 'method will be VM-protected';
    }
}