javascript-obfuscator / webpack-obfuscator

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

Critical dependency: the request of a dependency is an expression #99

Closed jmikrut closed 3 years ago

jmikrut commented 3 years ago

Hi there, thanks for the package!

I am using it to obfuscate a React component we're writing with default options. The component is built with Webpack 5 and Typescript as libraryTarget: 'commonjs2' and it builds properly, however, when I go to use the component in any other React project, I receive the following error:

Critical dependency: the request of a dependency is an expression

WARNING in ./node_modules/package-name/dist/bundle.js 1:22488-22503
Critical dependency: the request of a dependency is an expression

I've narrowed down the problem to this plugin, specifically.

I appreciate any insight!

Edit: could have to do with this issue?

https://github.com/javascript-obfuscator/obfuscator-loader/issues/1

sanex3339 commented 3 years ago

You can use ignoreRequireImports: false option

mspinelli commented 3 years ago

You can use ignoreRequireImports: false option

This doesn't appear to be part of v2.6 (I'm using webpack 4). Can this be back ported to v2?

sanex3339 commented 3 years ago

ignoreRequireImports is javascript-obfuscator option. So you have to install latest version of javascript-obfuscator as a peer dependency for webpack-obfuscator