Closed chalapathi444 closed 5 months ago
Hey @chalapathi444 haven't dug deep into this but have you checked this closed issue? Seems close to what you are asking #33
@chalapathi444 do you see the error when compiling TypeScript to JavaScript or running JavaScript code? It should work. See https://github.com/TechStark/opencv-js/blob/main/test/cv.ts#L6
I get the same error when parcel tries to transpile & optimize my code:
@parcel/optimizer-swc: cannot reassign to an imported binding
Also VSCode itself is warning me beforehand:
@davidjandrey-sv which version are you using? could you provide the code/demo page to show the issue?
@ttt43ttt I'm using it for my npm package: https://www.npmjs.com/package/intellicrop
I've reproduced this issue with 4.8.0-release.4 and 4.8.0-release.10. I can try to set up a demo page for you later on, but you can see the issue if you check out my package and just try to assign a new value to the onRuntimeInitialized
prop anywhere.
@davidjandrey-sv I've checked your package. Here is a way that can make it work.
"esModuleInterop": true
in tsconfig.json
(https://www.typescriptlang.org/tsconfig#esModuleInterop)import * as cv from "@techstark/opencv-js"
to import cv from "@techstark/opencv-js"
@ttt43ttt Yup, that worked flawless for me, thank you very much and have a nice weekend :)
onRuntimeInitialized is a read-only property., Not able to assign a function to it. Is there any way to know if the cv is initialized?