There's some information on debugging in the docs.nodebb.org portal
Prod vs Dev mode - uglifyjs turned off
I noticed that when I run the forum on dev mode, the client files are packed together and uglified. However, when I use prod mode, the code does not get uglified.
I'd like to have the code uglified, so should I work in dev mode?
I notice a warning in the admin page saying "Forum is running in development mode. The forum may be open to potential vulnerabilities; please contact your system admin.", so I am a bit worried.
Most likely I am running the forum incorrectly, and making an ass of myself.
But just in case the above is the intended behavior, how should i turn on production mode and pack/uglify the client code?
If you run
./nodebb buildit should minify all of the bundled assets. How are you checking whether it's minifying, etc?
Thanks for responding!
I am running ./nodebb build, but it does not minify and uglifies the code.
To see the client code, you may open "inspect" in chrom and upload any js file you wish - the source map are generated and are provided for all eyes to see
Kindly note that your forum exhibit the very same issue - just open inspect on chrome and then ALT-P and open "client.js" for example. Its open. There must be a reason for that I am sure, but in my specific case, I'd love to have my code uglified and packed.
I also use grunt. Grunt does uglifies the code, but only in dev mode.
I was correct in thinking you were confused. The files you're seeing in the developer tools are the source-mapped files. You aren't seeing the actual files as they're served to your browser.
For instance, compare the
translator.jsyou see in the developer tools on this site to the file at /assets/src/modules/translator.js. I can actually see the minified
nodebb.min.jsin the developer tools just fine, and it matches with what I see at /assets/nodebb.min.js.
The reason this occurs is because we don't produce the source-map for
nodebb.min.jswhen in dev mode, as the file isn't minified in that mode, just concatenated from the source files.
Thank you @PitaJ !
Is it possible to eliminate the source map in prod mode?
As far as I see, The source map are available to the client, and are debug-able in production mode.
You can delete all of the
.mapfiles in the build directory:
Grunt doesn't handle production builds. It's only for development. Without editing nodebb files there's isn't a way to disable creating the files, or to remove them after automatically.
However, you could make them appear as empty files or 404s through your reverse proxy.
Thank you so much. You were right on the money as usual!