Critical dependency: require function is used in a way in which dependencies cannot be statically extracted #134
vladmandic
started this conversation in
General
Replies: 1 comment
-
Thanks for the presented solution, it worked fine for the problem I was trying to solve on my project! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
WebPack version 5 changed how it handles dynamic imports
FaceAPI
library itself does not use dynamic imports, but bundled TensorFlow/JS inface-api.esm.js
includes some additional platform-specific capabilitiesFor example, WASM binaries can be loaded using filesystem read file calls, but only when platform is NodeJS
Presence of those dynamic capabilities detection calls causes WebPack to misinterpret type of a library used and generate warning messages:
Note that this is NOT AN ERROR, but simply a
WebPack
warning that can be safely ignored.However, if you want to eliminate such warnings,
solution is to explicitly specify in
WebPack
configuration thatHuman
is an ESM library:in
webpack.config.js
add:Note that WebPack is internally used by many frameworks and location of the config file may differ between frameworks (React, Angular, Vue, Next, etc.)
To see how to modify WebPack configuration in cases when non-default configuration files are used, check framework specific documentation.
Beta Was this translation helpful? Give feedback.
All reactions