View in #help on Slack
@Simon_Stemplinger: Hi! I have been deferring updating cornerstoneJS for a long time, because I kept getting the following build error:
yarn run v1.22.22
$ webpack --config webpack.config.js
assets by status 7.16 MiB [cached] 3 assets
cached modules 8.12 MiB (javascript) 5.38 MiB (webassembly) 8.2 KiB (runtime) [cached] 1167 modules
WARNING in ./node_modules/@icr/polyseg-wasm/dist/index.js 21:17-21
export 'default' (imported as 'wasm') was not found in './ICRPolySeg.wasm' (possible exports: $, Q, R, S, T, U, V, W, X, Y, Z, _, aa, ba, ca, da, ea, fa)
@ ./node_modules/@cornerstonejs/tools/dist/esm/workers/polySegConverters.js 4:0-43 28:31-41 55:34-44 117:34-44
...
ERROR in ./node_modules/@icr/polyseg-wasm/dist/ICRPolySeg.wasm
Module not found: Error: Can't resolve 'a' in '/Users/stemps/projects/radioeye/annotation_tool/node_modules/@icr/polyseg-wasm/dist'
resolve 'a' in '/Users/stemps/projects/radioeye/annotation_tool/node_modules/@icr/polyseg-wasm/dist'
Parsed request is a module
using description file: /Users/stemps/projects/radioeye/annotation_tool/node_modules/@icr/polyseg-wasm/package.json (relative path: ./dist)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
...
Do you have any advice how I can fix this? I use webpack 5.93.0.
@Alireza_Sedghi: downgrade webpack
@Simon_Stemplinger: to what version?
@Alireza_Sedghi: 85?
try adding the @icr/polyseg as a dependency too
@Simon_Stemplinger: Changing the webpack version only changed how the error message was formatted. The error stayed the same. @icr/polyseg was already pulled as a transitive dependency. I assume webpack tries to parse the .wasm file as a .js file. Didn’t get to looking into this further yet
@Alireza_Sedghi: I think you need to add that as dependency
did you try it?
@Simon_Stemplinger: just did… same error
@Alireza_Sedghi: sorry i meant his
“@icr/polyseg-wasm”: “^0.4.0”,
@Simon_Stemplinger: yep, that’s what I added
@Alireza_Sedghi: take a look at these two files in ohif and see what you are missing
https://github.com/OHIF/Viewers/blob/24c511f4bc04c4143bbd3d0d48029f41f7f36014/platform/app/.webpack/webpack.pwa.js
https://github.com/OHIF/Viewers/blob/88575c6c09fd778a31b2f91524163ce65d1639dd/.webpack/webpack.base.js
might be this in the rules?
{
test: /.wasm/,
type: ‘asset/resource’,
},
@Simon_Stemplinger: yeeees, that looks promising
Indeed, that’s it. Thanks a lot!
Also, webpack build seems to break somewhere after 5.85.0, but works again with the current (5.93.0)
@Alireza_Sedghi: yeah webpack has a bug after 85 i know
@Simon_Stemplinger: Finally got some time again to get back to this. with the webpack config change it now compiles, but when I’m interacting with the image stack I’m getting:
Uncaught TypeError: t.find is not a function
getTargetVolumeId BaseTool.js:46
mouseWheelCallback StackScrollToolMouseWheelTool.js:22
jl customCallbackHandler.js:28
o triggerEvent.js:10
Pe wheelListener.js:32
enable index.js:4
Lc addEnabledElement.js:12
dispatchEvent eventTarget.js:76
o triggerEvent.js:10
addCustomViewport RenderingEngine.js:411
enableElement RenderingEngine.js:91
Any idea what that might be?
@Alireza_Sedghi: Hmm
not raelly
tomorrow is office hours
we can discuss there
@Simon_Stemplinger: This seems to have been caused by CPU rendering. I had setUseCPURendering(true)
configured because GPU rendering caused issues a while ago. Removing that switch fixed the t.find is not a function
error mentioned above.
Sadly I don’t remember what the issue was but on the latest cornerstone version GPU rendering seems to work fine for me.
@Alireza_Sedghi: ok i’m happy to hear it is working