opencv-js icon indicating copy to clipboard operation
opencv-js copied to clipboard

Webpack.config.js

Open ZabeehUllah opened this issue 3 years ago • 8 comments

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

ZabeehUllah avatar Apr 15 '22 06:04 ZabeehUllah

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

ttt43ttt avatar Apr 16 '22 02:04 ttt43ttt

Can you please share a simpler boilerplate code?

ZabeehUllah avatar Apr 18 '22 04:04 ZabeehUllah

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)

ttt43ttt avatar Apr 19 '22 14:04 ttt43ttt

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

Capture

ZabeehUllah avatar Apr 21 '22 04:04 ZabeehUllah

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

ttt43ttt avatar Apr 21 '22 10:04 ttt43ttt

@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
    },

Karthick47v2 avatar Apr 21 '22 16:04 Karthick47v2

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

ZabeehUllah avatar Apr 22 '22 04:04 ZabeehUllah

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

ttt43ttt avatar May 02 '22 05:05 ttt43ttt