TechStark / opencv-js

OpenCV JavaScript version for node.js or browser
Apache License 2.0
353 stars 31 forks source link

ES Module (ESM) import compatibility #44

Open AronRubin opened 8 months ago

AronRubin commented 8 months ago

I need this patch script in my package.json to have opencv-js work with import in the browser (testing on Edge).

  "scripts": {
    ...
    "fix-opencv-import": "replace \"if[(]typeof window==='object'[)][{]root.cv=factory[(][)];[}]\" \"if(typeof window==='object'){window.cv=factory();}\" node_modules/@techstark/opencv-js/dist/opencv.js",
    ...
  },

Thank you