Enable refresh/ hot reload on code changes with pcsync

I’ve setup a workflow with local typescript code, which then sends my code as a bundle.js (via webpack) to Playcanvas upon code changes. It’s working great, but I’m wondering if there’s a way to get the launched scene to refresh the page, whenever a change is made to any code. Specifically to bundle.js. It seems like it’s only doable on a per-script basis. This would interest many people with the typescript or local workflow.

In my case it’s best to restart the whole scene. Is there a way to do this (to detect a new bundle.js uploaded to Playcanvas?) I think a lot of users would find this handy.

My bundle contains both playcanvas scripts, and also some standalone code. (For mulitplayer)

Any suggestions? Thanks in advance.

I’m afraid there isn’t an official or unofficial API to do this.

A workaround I can think is to use the scriptType ‘swap’ callback somehow to call a window refresh: Hot Reloading | Learn PlayCanvas Perhaps it can be a separate script that is modified before every pcsync push

Maybe there is a node package that has control of a Chrome window instance that you can use instead so that you can do a push and then a refresh?

1 Like