Skip to content
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

Test loader doesn't work : Critical dependency: the request of a dependency is an expression #138

Open
Pisamad opened this issue Mar 10, 2022 · 2 comments

Comments

@Pisamad
Copy link

Pisamad commented Mar 10, 2022

With NodeJS v16.13.0 on Windows

$ npm run build && npx webpack --config test/config/javascript-obfuscator-loader.config.js --stats-error-details

> webpack-obfuscator@3.5.1 build
> npx tsc

asset index.js 1.13 KiB [emitted] [minimized] (name: index) 1 related asset
asset index-excluded.js 1.02 KiB [emitted] [minimized] (name: index-excluded) 1 related asset
runtime modules 211 bytes 2 modules
cacheable modules 2.78 KiB
  ./test/input/index.js 1.41 KiB [built] [code generated]
  ./test/input/index-excluded.js 245 bytes [built] [code generated]
  ./test/input/nested.js 1.13 KiB [built] [code generated]
./test/input/ sync 160 bytes [built] [code generated]

WARNING in ./test/input/index.js 1:1127-1152
Critical dependency: the request of a dependency is an expression
    at CommonJsRequireContextDependency.getWarnings (xxx\webpack-obfuscator\node_modules\webpack\lib\dependencies\ContextDependency.js:91:18)
    at Compilation.reportDependencyErrorsAndWarnings (xxx\webpack-obfuscator\node_modules\webpack\lib\Compilation.js:3131:24)
    at xxx\webpack-obfuscator\node_modules\webpack\lib\Compilation.js:2728:28
    at _next2 (eval at create (xxx\webpack-obfuscator\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:25:1)
    at eval (eval at create (xxx\webpack-obfuscator\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:52:1)
    at xxx\webpack-obfuscator\node_modules\webpack\lib\FlagDependencyExportsPlugin.js:385:11      
    at xxx\webpack-obfuscator\node_modules\neo-async\async.js:2830:7
    at Object.each (xxx\webpack-obfuscator\node_modules\neo-async\async.js:2850:39)
    at xxx\webpack-obfuscator\node_modules\webpack\lib\FlagDependencyExportsPlugin.js:361:18      
    at xxx\webpack-obfuscator\node_modules\neo-async\async.js:2830:7
@rubixibuc
Copy link

rubixibuc commented Apr 15, 2022

there was a property ignoreRequireImports but it was renamed to ignoreImports. The readme wasn't updated in every location. Try setting that to true, ignoreImports: true

javascript-obfuscator/javascript-obfuscator@faaab45

@rasgo-cc
Copy link

rasgo-cc commented Dec 7, 2022

@rubixibuc you just made my day, thank you. Just for reference, I'm using:

"webpack": "^5.75.0",
"webpack-obfuscator": "3.3.2"
"javascript-obfuscator": "^4.0.0",

with Electron.

And if I don't set ignoreImports: true I get random "cannot find module" errors when starting the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants