I am trying to use vtkVolumeController to create the volumeController as shown in example VolumeViewer,so I import vtkVolumeController from ‘vtk.js/Sources/Interaction/UI/VolumeController’.
But when I run npm run build, the following problem occurred:WARNING in ./node_modules/vtk.js/Sources/Interaction/Widgets/PiecewiseGaussianWidget/index.js 536:23-45
"export ‘default’ (imported as ‘ComputeHistogramWorker’) was not found in ‘./ComputeHistogram.worker’.
I don’t know what went wrong, can anyone help me?Thanks!
Hi, are you using worker-loader
in your webpack config? That loader should transform worker files so that the import works.
Check out the needed rules here: https://github.com/Kitware/vtk-js/blob/master/Utilities/config/rules-vtk.js#L53
Oh, you are right,I didn’t use worker-loader in my webpack config. Thanks a lot! By the way, I can’t use options:{ inline: ‘no-fallback’ } } but can use options: {inline: true, fallback: false }. I am curious, is this because I am using webpack4? Thanks again!
Yep! I believe worker-loader version 2 used the options object that you used, but with worker-loader version 3, they updated to webpack 5 and changed the options object to have the ‘no-fallback’ value.