The examples are written in the style they are because they are intended to be small units of functionality, and easy to examine the code without digging into multiple source files, but for anything of scale that you’re building, you really want some kind of tree of source code.
I think you’ll find that adding code directly in the HTML gets harder over time.
It’s best to include your “./main.js” as a type=‘module’ script tag, and then build off of there.
Or to have one script tag of type=‘module’ and import the main functionality inside that tag, from other source files.
(Check out how the HTML looks for the threejs editor… three.js editor
It has a main type=‘module’ tag, and then imports most of the functional code in there, and only has the highest level state machine and event hookups in the .html
Also chrome debugger/vscode has a hard time with breakpoints/editing and hot reloading when editing the .html directly.