Overview

When using Create-React-App or Next.js for a DOT Web project instead of Vite, an error occurs: 

"Module not found: Can't " resolve 'dot_embedded_bg.wasm'



Symptoms

The following compilation errors occurred after executing the project: 


⨯ ./node_modules/@innovatrics/dot-document-auto-capture/index.mjs:9796:0
Module not found: Can't resolve 'dot_embedded_bg.wasm' 


Root Cause

The problem is related to ESM vs UMD module formats. The library provides two builds:
 ESM: index.js / index.mjs 

UMD: index.umd.js


The ESM build loads the wasm using import.meta ->  import.meta only works in true ESM environments.

Some frameworks or configurations do not fully support import.meta in node_modules, so the bundler cannot resolve the .wasm file.



Resolution 

If your framework doesn't support import.meta, you must use the UMD build (index.umd.js ) instead. 


Additional Notes

Additionally, ensure that the wasm directory from your destination is also copied to the public directory.