Closed phcerdan closed 3 years ago
Workers are expected to be handled by a dedicated loader.
Isn't the warning still valid? There is no ComputeHistogramWorker
in that file?
It is used here:
import ComputeHistogramWorker from './ComputeHistogram.worker';
const worker = new ComputeHistogramWorker();
const workerPromise = new WebworkerPromise(worker);
No, I would not think so.
I see, although the warning is generated from current code from visualizer. I thought it belonged here.
That is an issue on how visualizer is setup (loader config).
Probably when Visualizer started to use the vtk.js class, that class was not using any worker and therefore everything was fine. But when we updated vtk.js inside Visualizer a while back we broke it by not adding the proper loaders to handle the workers properly.
This should be fixed but I guess no one get to it ;-)
Thanks @jourdain. Give me a couple of months and I might get up to speed with javascript and a small niche of its rapid-changing ecosystem to start fixing my own findings! Meanwhile, I just report issues as I find them :)
Closing, as it belongs to kitware/visualizer.
Workers are expected to be handled by a dedicated loader.
Hi Jourdain, may I know what do you mean by a dedicated loader? cause I got the following error when trying to use itkwidgets(which used itk-vtk-viewer, which used vtk.js).
Attempted import error: './ComputeHistogram.worker' does not contain a default export (imported as 'ComputeHistogramWorker').
ERROR in ./node_modules/itk-vtk-viewer/node_modules/vtk.js/Sources/Interaction/Widgets/PiecewiseGaussianWidget/index.js 490:25-47
export 'default' (imported as 'ComputeHistogramWorker') was not found in './ComputeHistogram.worker' (module has no exports)
ERROR in ./node_modules/itk-vtk-viewer/node_modules/vtk.js/Sources/Rendering/Core/Camera/index.js 502:6-17
export 'quat'.'toMat4' (imported as 'quat') was not found in 'gl-matrix' (possible exports: add, calculateW, clone, conjugate, copy, create, dot, equals, exactEquals, exp, fromEuler, fromMat3, fromValues, getAngle, getAxisAngle, identity, invert, len, length, lerp, ln, mul, multiply, normalize, pow, random, rotateX, rotateY, rotateZ, rotationTo, scale, set, setAxes, setAxisAngle, slerp, sqlerp, sqrLen, squaredLength, str)
And I checked the vtk.js/Utilities/config/dependency.js has the loader for worker.js, is there any step required to set it up correctly?
{
test: /\.worker\.js$/,
include: /vtk\.js[\/\\]Sources/,
use: [
{
loader: 'worker-loader',
options: { inline: true, fallback: false },
},
],
},
Linking your itkwidgets issue for cross-referencing purposes: https://github.com/InsightSoftwareConsortium/itkwidgets/issues/668
This is a project build process issue, where the project using vtk.js doesn't properly ingest vtk.js source files. I don't think this is a vtk.js issue, but rather a downstream project issue.
Linking your itkwidgets issue for cross-referencing purposes: InsightSoftwareConsortium/itkwidgets#668
This is a project build process issue, where the project using vtk.js doesn't properly ingest vtk.js source files. I don't think this is a vtk.js issue, but rather a downstream project issue.
Thanks floryst, is there any guide on how I can make the downstream project configure right? I checked the intro_vtk_as_es6_dependency and old_intro_vtk_es6, and I checked the webpack.config.js, which has the vtkRules configured and has the loader for worker.js, https://github.com/Kitware/itk-vtk-viewer/blob/master/webpack.config.js#L56-L69. So is there anything else I should check to?
Imported here: https://github.com/Kitware/vtk-js/blob/master/Sources/Interaction/Widgets/PiecewiseGaussianWidget/index.js#L6
import ComputeHistogramWorker from './ComputeHistogram.worker';
But there is no export default in ComputeHistogram.worker.js
The other worker: https://github.com/Kitware/vtk-js/blob/master/Sources/Filters/General/PaintFilter/PaintFilter.worker.js might suffer the same warning, but haven't tested.