• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.1 Latest
Buy Hosting

Prod vs Dev mode - uglifyjs turned off

Scheduled Pinned Locked Moved Technical Support
9 Posts 2 Posters 802 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JJSagan
    wrote on last edited by
    #1

    Dear Devs,

    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?

    Thank you!
    JJ.

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #2

    If you run ./nodebb build it should minify all of the bundled assets. How are you checking whether it's minifying, etc?

    J 1 Reply Last reply
    0
  • J Offline
    J Offline
    JJSagan
    replied to PitaJ on last edited by
    #3

    Hi @PitaJ

    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.

    Any thoughts?
    Thanks!!!
    JJ

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #4

    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.js you 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.js in 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.js when in dev mode, as the file isn't minified in that mode, just concatenated from the source files.

    J 1 Reply Last reply
    0
  • J Offline
    J Offline
    JJSagan
    replied to PitaJ on last edited by
    #5

    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.

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #6

    You can delete all of the .map files in the build directory:

    rm ./build/**/*.map
    
    J 1 Reply Last reply
    0
  • J Offline
    J Offline
    JJSagan
    replied to PitaJ on last edited by
    #7

    @PitaJ said in Prod vs Dev mode - uglifyjs turned off:

    rm ./build/**/*.map

    Thank you so much @PitaJ .
    Is there a way to remove the source files automatically in grunt (in production mode), prior to execution?
    Thank you in advance!
    JJ

    1 Reply Last reply
    0
  • PitaJP Offline
    PitaJP Offline
    PitaJ Global Moderator Plugin & Theme Dev
    wrote on last edited by
    #8

    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.

    1 Reply Last reply
    0
  • J Offline
    J Offline
    JJSagan
    wrote on last edited by
    #9

    Thank you so much. You were right on the money as usual!

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development