javascript-obfuscator / webpack-obfuscator

javascript-obfuscator plugin for Webpack
https://github.com/javascript-obfuscator/javascript-obfuscator
BSD 2-Clause "Simplified" License
853 stars 84 forks source link

Webpack obfuscator not working for webpack 4.xx versions #128

Closed premkumarthanigaivel closed 2 years ago

premkumarthanigaivel commented 2 years ago

Webpack version: ^4.41.2 Webpack-dev-server:^3.9.0 Webpack-cli:^3.3.10

Webpack Obfuscator returning this error while running with webpack dev server:

Uncaught TypeError: __webpack_require__(...) is not a function at eval (webpack:///(:8081/webpack)/buildin/module.js?:2:123) at Object../node_modules/webpack/buildin/module.js (main.367d319a1f307a626a92.js:19402) at webpack_require__ (main.367d319a1f307a626a92.js:790) at fn (main.367d319a1f307a626a92.js:101) at eval (index.js:2) at Object../node_modules/strip-ansi/index.js (main.367d319a1f307a626a92.js:19040) at webpack_require__ (main.367d319a1f307a626a92.js:790) at fn (main.367d319a1f307a626a92.js:101) at Object.eval (webpack:///(:8081/webpack)-dev-server/client?:1:742) at eval (webpack:///(:8081/webpack)-dev-server/client?:2:30)

Per the suggestion from npm website installed below versions of obfuscator: webpack-obfuscator: "0.18.3" javascript-obfuscator: "0.18.3"

premkumarthanigaivel commented 2 years ago

After excluding node modules, works like a charm

joshuakoh1 commented 2 years ago

@premkumarthanigaivel How do you exclude node_modules? List them one by one?

premkumarthanigaivel commented 2 years ago

@premkumarthanigaivel How do you exclude node_modules? List them one by one?

@joshuakoh1 Its my bad, that i was expecting obfuscator to run in webpack dev server, only later did i realise that, static build is working fine.