-
Notifications
You must be signed in to change notification settings - Fork 37
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
Error on class static field #116
Comments
you can work around it with the es5 option estools/escodegen#443, estools/escodegen#438 |
Thank you, @j4k0xb, using For the suggestions about |
for michael |
Thank you! Just for the record, I have another issue, when I use const code = `
function f() {}
() => { f(); };
`;
const options = {
target: 'node',
preset: 'low',
es5: true,
};
require('js-confuser')
.obfuscate(code, options)
.then(t => console.log(t)) When executed, I get the following error (sometimes, not all the time, but I'd say above 50%):
When it fails, it is indeed not a If I change the test code from: function f() {}
() => { f(); }; to: function f() {}
() => {
const f = f;
f();
}; then it never fails anymore. Just in case it can help if/when testing other libs. |
minify runs before es5 and theyre kinda incompatible 🤔 js-confuser/src/transforms/minify.ts Line 339 in b1fcb1d
js-confuser/src/transforms/es5/es5.ts Line 73 in b1fcb1d
|
Fixed in 2.0 (Currently 2.0.0-alpha.2). The 2.0 version nows uses Babel's parser and generator and is more suited for modern JavaScript syntax. The ES5 option is removed in 2.0 - Babel implementation is more reliable |
Describe the bug:
When the code to confuse contains a class with a static field, an error is thrown and code generation does not complete.
Config and Small code sample
Repro:
Expected behavior
This example should pass and generate the corresponding, confused code.
Actual behavior
It throws an error:
Additional context
It seems that in
CodeGenerator.prototype.generateExpression()
, the expressionthis[type]
is undefined whentype
isPropertyDefinition
.The text was updated successfully, but these errors were encountered: