web-ifc-three
web-ifc-three copied to clipboard
IFCWorker.js setup in Next.js
I have problem setting up the IFCWorker from 0.0.117 in Next.js environment. I tried the following
await manager.useWebWorkers(true, "IFCWorker.js"); // the IFCWorker.js is located in the same directory as the source code
but it resulted
error - node_modules/web-ifc-three/IFCLoader.js (2797:25) @ Worker
error - unhandledRejection: ReferenceError: Worker is not defined
at new IFCWorkerHandler (webpack-internal:///./node_modules/web-ifc-three/IFCLoader.js:2502:30)
at IFCManager.initializeWorkers (webpack-internal:///./node_modules/web-ifc-three/IFCLoader.js:2955:23)
at IFCManager.useWebWorkers (webpack-internal:///./node_modules/web-ifc-three/IFCLoader.js:2843:24)
at releaseMemory (webpack-internal:///./src/contexts/IfcLoaderContext.tsx:23:32)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
null
Has anyone encountered this issue?
Were you able to setup WASM successfully?
Yes, the WASM can be loaded without any issues.
I tried the following 2 approaches:
1: Load external hosted IFCWorker.js with CORS settings but having problem of 'Worker' Script at ... cannot be accessed from origin
2: Place both woker scripts and wasm files in Nextjs public folder. This does render the IFC file successfully but the Nextjs console shows the following error right after the startup. Not sure why IFC file can still be loaded using IFCLoader in this case.

Check this thread on discord https://discord.com/channels/799990228336115742/1091078047228235877
hi is there a solution to this issue yet? I am using next js 13