Next.js Discord

Discord Forum

Install @techstark/opencv-js in Next.Js 14 project

Unanswered
Tan posted this in #help-forum
Open in Discord
TanOP
I tried to install opencv and I'm getting this error: TypeError: Cannot set properties of undefined (setting 'cv').

I already configured webpack:
const nextConfig = {
    webpack: (config) => {
        config.resolve.fallback = { fs: false, path:false, "crypto": false  };
        return config;
    },
};


And this is how I import it:
"use client"
import cv from "@techstark/opencv-js"
export default function Home() {
  return (
    <div onClick={() => {
      console.log(cv)
    }} className="">
      CLICK
    </div>
  );
}


What am I doing wrong?

0 Replies