playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
154 stars 28 forks source link

Concatenation issue #1133

Open LeXXik opened 5 months ago

LeXXik commented 5 months ago

Creating worker fails, when Launcher is started with "Concatenate Scripts" option:

image

Related forum: https://forum.playcanvas.com/t/new-worker-causing-build-fail/35411 Repro: https://playcanvas.com/project/1204252/overview/concatenation-issue

leonidaspir commented 5 months ago

I think that works as expected given all preloaded scripts will be included in the concatenated script file.

Does setting preload = false to the worker script fix this? That's the proposed way to treat worker script files on production builds too. There is rarely a reason to preload worker scripts since the worker will request the files separately.

LeXXik commented 5 months ago

Yes, it works correctly without concatenation. In our production builds, we download non-concatenated build and concatenate/minify it ourselves, so we have a control over what is concatenated.

Still could be useful in Launcher, when the project has many scripts, as loading is much faster with concatenated option in that case. Perhaps a boolean property could be added to script asset to be excluded from concatenation.

Edit: Leonidas, your suggestion on the forums is a good one, so adding here for record - the workaround would be to set the worker script preload to false.