Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IFCWorker.js setup in Next.js #154

Open
kuo-cheng-wu opened this issue Feb 25, 2023 · 4 comments
Open

IFCWorker.js setup in Next.js #154

kuo-cheng-wu opened this issue Feb 25, 2023 · 4 comments

Comments

@kuo-cheng-wu
Copy link

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?

@TUGTEN
Copy link

TUGTEN commented Mar 31, 2023

Were you able to setup WASM successfully?

@kuo-cheng-wu
Copy link
Author

kuo-cheng-wu commented Apr 1, 2023

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.
image

@sinedie
Copy link

sinedie commented May 9, 2023

Check this thread on discord https://discord.com/channels/799990228336115742/1091078047228235877

@ywouterr
Copy link

hi is there a solution to this issue yet? I am using next js 13

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants