TechStark / opencv-js

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

Webpack.config.js #10

Closed ZabeehUllah closed 9 months ago

ZabeehUllah commented 2 years ago

Which modules are to be added in webpack.config.js and how to add modules in webpack.config.js file? I am using Reactjs.

image

ttt43ttt commented 2 years ago

You can check the example here https://codesandbox.io/s/techstarkopencv-js-demo-page-f7gvk

ZabeehUllah commented 2 years ago

Can you please share a simpler boilerplate code?

ttt43ttt commented 2 years ago

there is no need to add modules to webpack.config.js you need to add @techstark/opencv-js to package.json (yarn add @techstark/opencv-js or npm install @techstark/opencv-js)

ZabeehUllah commented 2 years ago

I already have installed the required dependency. It's still giving me the same error.

Capture

ttt43ttt commented 2 years ago

@ZabeehUllah see https://github.com/TechStark/opencv-js#webpack-configuration-for-browser-usage for how to configure webpack

Karthick47v2 commented 2 years ago

@ZabeehUllah in case if you are asking for where & how to configure webpack,

  1. webpack.config.js will be in node-modules\react-scripts\.
  2. Search for resolve: in webpack, (or Search module.exports, resolve will be in return of this function)
  3. Paste the above codeblock next to module:[.....]
fallback: {
      fs: false,
      path: false,
      crypto: false
    },
ZabeehUllah commented 2 years ago

@Karthick47v2 Thank you so much. I was looking for this. Issue resolved.

ttt43ttt commented 2 years ago

Also see example https://github.com/TechStark/opencv-js-examples/blob/develop/opencv-js-react-example/config-overrides.js