Hi, I wonder if it is possible to add some flag or some setting to update so that I can have more debug information when I am developing an extension locally?
franklingu Hi there. This is a great discussion to have.
What kind of debug information are you looking for?
(You do have debug mode turned on in config.php, right?)
One more question not related to this topic but keep to know: how do I recompile assets when I change something in extension?
I just saw the huge stacktrace... something went wrong with my code. my prev question remains
I am just starting getting familiar with php and flarum--and babel. so maybe I am still quite lost. but like from Django || Rails(especially) experience, I would be able to see many logs in dev and even stacktrace when something breaks.
The localhost page isn’t working
localhost is currently unable to handle this request.
so when I do js request to backend and find this, logging with what went wrong maybe a lot helpful
You might want to read https://discuss.flarum.org/d/1662-extension-developer-first-read
Related to your compilation question, all JS of Flarum is compiled using Gulp, this is available through NPM the node package manager. Every time you make changes to the JS of your extension you will need to manually run gulp in the js/forum or js/admin directories to recompile the js-files in the assets directory.
luceos Every time you make changes to the JS of your extension you will need to manually run gulp in the js/forum or js/admin directories to recompile the js-files in the assets directory.
In fact, if you run gulp watch, it will keep watching the source JS files for changes and automatically recompile them for you. ?
luceos I am still a bit confused. so if I run gulp inside that directory, the JS in js/src is going to compiled do dist right? but how does that get collected and compiled into forum-*.js in the outer most assets directory?
franklingu Flarum does that by collecting the assets that were registered by extensions (example), and concatenates them together. It will do that automatically for you.