I'm facing an issue with opencv.js with my ionic capacitor app.
I put my opencv.js into src/assets/lib/opencv.js
and I declare it like that in my ts file: declare var cv: any
and in my main index.html
I symply do <script src="./assets/lib/opencv.js"></script>
It work well when i'm using ionic serve
but when I'm running an npx cap open electron
it doesn't work because of ReferenceError: cv is not defined
I tried to use typescript way to import the file like import "./assets/lib/opencv.js"
or import * as cv from "./assetS/lib/opencv.js"
but it doesn't work at all. Maybe I missing something with that way to import my file.
Do you have, please, some idea or things to try ?
Many thanks in advance.
Edit : I found the solution.
'import cv from './../../assets/lib/opencv.js'
in your ts fileIf you get error with "crypto" , "fs" , etc ... add :
"browser": {
"fs": false,
"crypto": false,
...
}
I found the solution.
'import cv from './../../assets/lib/opencv.js'
in your ts fileIf you get error with "crypto" , "fs" , etc ... add :
"browser": {
"fs": false,
"crypto": false,
...
}