Critical dependency: require function is used in a way in which dependencies cannot be statically extracted

See original GitHub issue

Bug report

WARNING in ./node_modules/bin-wrapper/index.js 5:34-41
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
 @ ./node_modules/pngquant-bin/lib/index.js
 @ ./node_modules/pngquant-bin/index.js
 @ ./node_modules/imagemin-pngquant/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

WARNING in ./node_modules/execa/node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'spawn-sync' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/execa/node_modules/cross-spawn'
 @ ./node_modules/execa/node_modules/cross-spawn/index.js
 @ ./node_modules/execa/index.js
 @ ./node_modules/exec-buffer/index.js
 @ ./node_modules/imagemin-webp/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

WARNING in ./node_modules/imagemin-mozjpeg/node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'spawn-sync' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/imagemin-mozjpeg/node_modules/cross-spawn'
 @ ./node_modules/imagemin-mozjpeg/node_modules/cross-spawn/index.js
 @ ./node_modules/imagemin-mozjpeg/node_modules/execa/index.js
 @ ./node_modules/imagemin-mozjpeg/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'child_process' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/cross-spawn'
 @ ./node_modules/cross-spawn/index.js 3:11-35
 @ ./node_modules/imagemin-pngquant/node_modules/execa/index.js
 @ ./node_modules/imagemin-pngquant/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/execa/index.js
Module not found: Error: Can't resolve 'child_process' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/execa'
 @ ./node_modules/execa/index.js 2:21-45
 @ ./node_modules/exec-buffer/index.js
 @ ./node_modules/imagemin-webp/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/execa/node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'child_process' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/execa/node_modules/cross-spawn'
 @ ./node_modules/execa/node_modules/cross-spawn/index.js 3:9-33
 @ ./node_modules/execa/index.js
 @ ./node_modules/exec-buffer/index.js
 @ ./node_modules/imagemin-webp/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/imagemin-mozjpeg/node_modules/cross-spawn/index.js
Module not found: Error: Can't resolve 'child_process' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/imagemin-mozjpeg/node_modules/cross-spawn'
 @ ./node_modules/imagemin-mozjpeg/node_modules/cross-spawn/index.js 3:9-33
 @ ./node_modules/imagemin-mozjpeg/node_modules/execa/index.js
 @ ./node_modules/imagemin-mozjpeg/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/imagemin-mozjpeg/node_modules/execa/index.js
Module not found: Error: Can't resolve 'child_process' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/imagemin-mozjpeg/node_modules/execa'
 @ ./node_modules/imagemin-mozjpeg/node_modules/execa/index.js 2:21-45
 @ ./node_modules/imagemin-mozjpeg/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps

ERROR in ./node_modules/imagemin-pngquant/node_modules/execa/index.js
Module not found: Error: Can't resolve 'child_process' in '/home/arindampradhan/Bitbucket/website_v3/node_modules/imagemin-pngquant/node_modules/execa'
 @ ./node_modules/imagemin-pngquant/node_modules/execa/index.js 3:21-45
 @ ./node_modules/imagemin-pngquant/index.js
 @ ./node_modules/image-webpack-loader/index.js
 @ dll reactBoilerplateDeps
Done in 13.98s.

What is the current behavior?

After installing new modules like https://github.com/Hellenic/react-hexgrid the build started failing

What is the expected behavior?

Other relevant information: webpack version: “4.12.0”
Node.js version: v8.11.3 Operating System: Ubuntu 14.04.5 LTS Additional tools: yarn

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

13reactions
shanethmoorecommented, Oct 25, 2018
9reactions
arindampradhancommented, Aug 14, 2018

Fixed it. sorry for the inconvenience … Regards

Read more comments on GitHub >

github_iconTop Results From Across the Web

Critical dependency: require function is used in a way in which ...
Critical dependency : require function is used in a way in which dependencies cannot be statically extracted · Subscribe to RSS.
Read more >
Critical dependency: require function is used in a way ... - GitHub
The error originates from the esm target, which should not have any require statements. It'd be nice to explore that built module and...
Read more >
Incompatible with Webpack - Google Groups
"require function is used in a way, in which dependencies cannot be statically extracted" These errors come when trying to "require" specific modules, ......
Read more >
Critical dependency: require function is ... - Auth0 Community
Error message : Critical dependency: require function is used in a way in which dependencies cannot be statically extracted.
Read more >
Node.js – WARNING in Critical dependency: require function ...
Node.js – WARNING in Critical dependency: require function is used in a way in which dependencies cannot be statically extracted. angularnode.jswebpack.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found