d-markey / squadron_builder

Dart code generator for Squadron workers. Implement your worker service and let squadron_builder bridge the gap with Web Workers and Isolates!
https://pub.dev/packages/squadron_builder
MIT License
15 stars 3 forks source link

Web - "It seems no worker code lives at lib/squads/fib.web.g.dart.js" #13

Closed sethepeterson closed 7 months ago

sethepeterson commented 9 months ago

I'm attempting to integrate Squadron into my Flutter app. I followed the fibonacci example, but when running on web I get a runtime error:

[2024-02-13T17:13:30.982Z] [CONFIG] [HELLO_WORLD] created Web Worker #HELLO_WORLD.1 [2024-02-13T17:13:31.011Z] [WARNING] [HELLO_WORLD] Unhandled error from Web worker #HELLO_WORLD.1: !! WARNING: it seems no worker code lives at lib/squads/fib.web.g.dart.js: error / [object Event]. [2024-02-13T17:13:31.012Z] [WARNING] [HELLO_WORLD] It seems no worker code lives at lib/squads/fib.web.g.dart.js.

I've checked that the @SquadronService annotation is not disabling web support. The calling code is using the "Worker" constructor. Does the javascript file need to be created manually in another step?

Thanks for the effort on the package and the help! -Seth

d-markey commented 9 months ago

Hello,

yes, you have to compile the Worker code to JavaScript manually.

There's an example here: https://github.com/d-markey/squadron?tab=readme-ov-file#releasing-your-app

Hope this helps!