Error if there is an "Import" statement at the beginning of js file
See original GitHub issueI am receiving an error if the js file consists of import statement. For example, here is the content of the test.js file:
import { test1} from "./test1";
window.onload = () => {
console.log("Test");
};
command executed: javascript-obfuscator test.js --compact true
Here is the error received:
Error: Line 1: Unexpected token at Function.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:270611) at Function.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:270464) at e.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:266641) at e.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:266398) at Function.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:28815) at Function.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:44810) at e.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:44551) at e.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:11351) at e.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:44257) at e.value (C:\Users\pavma\AppData\Roaming\npm\node_modules\javascript-obfuscator\dist\index.js:24:11351)
javascript-obfuscator -v 0.14.3 node -v v8.9.4 npm -v 5.6.0
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:9 (6 by maintainers)
Top GitHub Comments
Related to
esprima
. Obfuscator usingparseScript
method, but your code ismodule
.So i’ll wrap it in try-catch. If it will fail on
parseScript
- obfuscator will runparseModule
javascript-obfuscator@0.15.0
just published to the npm!