Next.js Discord

Discord Forum

WebWorker is not "statically analyse-able"

Answered
American Shorthair posted this in #help-forum
Open in Discord
American ShorthairOP
Hello, I am importing some legacy .js code from a game engine I made awhile ago.
 useEffect(() => {
        const renderGame= async () => {
            const VoxelRender = await import("../lib/VoxelRender");
            VoxelRender.default();
        };
    
        renderGame();
    });


the issue is, this VoxelRenderer ends up using a Worker (as the rendering uses WebWorkers to mesh the game)

error TP1001 new Worker("/public/game/blockCulling.js") is not statically analyse-able
  75 |
  76 | //Start culling proccess and send chunk data
> 77 | var cullWorker = new Worker('/public/game/blockCulling.js');            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


What am I doing wrong here? All the other code is imported properly on the client, it just doesn't like this part.
Thanks!
Answered by American Shorthair
View full answer

2 Replies

American ShorthairOP
Answer
American ShorthairOP
Can't mark my own message as answer?