Closed katiamar63 closed 6 years ago
Yes, please see the Webpack example documentation:
https://insightsoftwareconsortium.github.io/itk-js/examples/webpack.html
Also, the Unpkg.com / CDN provides another example using the Webpack publicPath
:
https://insightsoftwareconsortium.github.io/itk-js/examples/unpkgio.html
Thank you, I already applied that and it works.
I implemented React application which is using ITK Readers for browsing MRI images. Everything was built in Webpack and worked perfectly as long as I was using only one element in url context path (when images where loaded). When I introduced React Router to my application and started to use longer context paths, the IO Image Workers were not visible anymore (HTTP 404 error). The Chrome inspector was showing error in line 23 of
createWebWorkerPromise.js
wherenew window.worker(...)
is created. The path to the worker contained too many elements, whilst the working one was: '{domain_url}/itk/WebWorkers/ folder, eg. {domain_url} itk/WebWorkers/ImageIO.worker.js {domain_url}/itk/ImageIOs/itkNiftiImageIOJSBindingWasm.js.I found that if I change itkConfig.js (in /node_modules), the problem is solved and workers are loaded from proper urls, i.e.
Is it possible to 'inject' my own itkConfig.js using Webpack? Can I replace itkConfig with webpack using similar solution to one described for Karma testing?