I wanted to update one of the system components. For this, I’d like to run one of the /examples that depend on that component, while doing the changes to the engine. I want the engine to hot reload and show the changes I make. What are the steps for me on Windows? There are quite a few build steps now and I am not sure what needs to run in what order or what are the prerequisites to run the examples with hot reloading engine and examples sources.
I usually run these in the engine folder:
cd $PLAYCANVAS_HOME/engine npm run watch:debug
And this for the examples:
cd $PLAYCANVAS_HOME/engine/examples npm run watch npm run serve
and just point the browser at the path that the serve printed and reload the page when auto build is ready
@mvaligursky thank you!
@mvaligursky hmm, after following the steps, I get to build the engine fine and it starts watching it, as well as the examples. However serving the examples is an issue. It tries to fetch a local file (E:\dev\playcanvas…), which obviously won’t work. Do I need to do some setup for localhost? Like setting some env variables or something? For example, I don’t have $PLAYCANVAS_HOME, but not sure if it matters.
calling @Elliott on this one
@Elliott I have the following “path” to the engine, which fails to reach, so the examples do not start for me. Would you have an idea?
I don’t know the exact problem but use
/ or double backslash
\\ for paths
Right, but this is a piece of code that is present in all examples and is auto-generated by
npm run build.
@Elliott - any thoughts on this one?
This must be a Windows only issue that i’ll have to test. It looks like on windows the default path resolves to something that can’t be used by the fetch api. However for now, if you host your playcanvas.js script on a server you can set the examples browser scripts ENGINE_PATH environment variable to that url instead of a relative path. E.g
ENGINE_PATH=http://localhost:5000/playcanvas.js npm run watch
@Elliott thank you for the suggestion!
So, I modified a little your env value, to point to the build folder, as it wasn’t able to locate playcanvas.js in the root:
This worked for me:
ENGINE_PATH=http://localhost:5000/build/playcanvas.js npm run watch
The examples still fail to locate the thumbnails in the menu, but I guess it is related to the same issue. I can ignore it, as the examples work now:
That actually points to the build folder inside the examples… hmm…
Right, that is what you actually suggested. I launched another local server that serves the build folder and pointed the env variable to that server.
the thumbnails you need to build - there’s a command for this in the readme (not that I do either, I just ignore them)