import WorkerFactory Error in React

the import statement in PiecewiseGaussianWidget.js file bellow occurs error when compiled in react project.

import { W as WorkerFactory } from '../../_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js';

who can tell me how to deal with the error.
Compiled with problems:X

ERROR in ./node_modules/@kitware/vtk.js/Interaction/Widgets/PiecewiseGaussianWidget.js 546:23-36

export ‘W’ (imported as ‘WorkerFactory’) was not found in ‘…/…/_virtual/rollup-plugin-worker-loader__module_Sources/Interaction/Widgets/PiecewiseGaussianWidget/ComputeHistogram.worker.js’ (possible exports: default)

What version of vtk.js are you using? And is this with create-react-app?

vtkjs version:24.14.2, with create-react-app.

I would recommend upgrading if that is possible for you, since we are on v25 now. If upgrading is not possible, I can investigate to see if that version has a faulty export.

I have upgraded @kitware/vtk.js to the latest(v25.1.3), the error still exists…

Hm, it could be that create-react-app is auto-transforming *.worker.js, but I don’t imagine why they would be doing that for node_modules. Do you have a minimal proof of concept repo that reproduces this problem?

vtkjs-app.rar (950.6 KB)
here is my simplified project, many thanks…

Ah, the rules you have in config-overrides.js is unnecessary. You don’t need the worker-loader, since that worker file is already transpiled in the @kitware/vtk.js package.

Thank you, Forrest, my friend, I think too much…