javascript-obfuscator / gulp-javascript-obfuscator

Gulp plugin for javascript-obfuscator package.
100 stars 38 forks source link

TypeError with jquery #31

Closed drkNsubuga closed 4 years ago

drkNsubuga commented 4 years ago

Summary

I get a TypeError when Jquery minified version is included in the source files yet I do see any errors without obfuscation.

Expected Behavior

No console errors are expected after obfuscation.

Current Behavior

This is the console log in Chrome

jquery-3.4.1.min.js:2 Uncaught TypeError: Object.defineProperty called on non-object
    at Function.defineProperty (<anonymous>)
    at SE.cache (jquery-3.4.1.min.js:2)
    at SE.get (jquery-3.4.1.min.js:2)
    at Object.add (jquery-3.4.1.min.js:2)
    at Number.<anonymous> (jquery-3.4.1.min.js:2)
    at Function.each (jquery-3.4.1.min.js:2)
    at Sm.fn.init.each (jquery-3.4.1.min.js:2)
    at GB (jquery-3.4.1.min.js:2)
    at Sm.fn.init.on (jquery-3.4.1.min.js:2)

A similar error is shown in firefox

Uncaught TypeError: Object.defineProperty called on non-object

Steps to Reproduce

  1. Upgrade to latest gulp-javascript-obfuscator
  2. Enable sourcemaps using 'gulp-sourcemaps'
  3. Add jquery-x.x.x.min.js to the src files

Environment

Minimal working example that will help to reproduce issue

const sourcemaps = require('gulp-sourcemaps');
const javascriptObfuscator = require('gulp-javascript-obfuscator');

gulp.src('jquery-3.4.1.min.js')  //Also tried with Jquery-3.5.1
    .pipe(sourcemaps.init())
    .pipe(concat('build.min.js'))
    .pipe(javascriptObfuscator({
        compact: true
    }))
    .pipe(sourcemaps.write())
    .pipe(gulp.dest('dist'));