Skip to main content

Command Palette

Search for a command to run...

Magento 2 Compiling on server or client-side? (Pros and Cons)

Published
2 min read
Magento 2 Compiling on server or client-side? (Pros and Cons)
R

I work at LeSite as Technology Director, where I’m responsible for lead the technical team to building innovative products.

My passion for building software and sharing knowledge brought me to speak in over 14 conferences and create 21 projects used for more than 20,000 developers in the world. Now, I’m focused on helping merchants bringing innovation and technology strategy to their e-commerce ecosystem using the Magento 2, Adobe Commerce, Shopify Plus and other platforms.

What's the better way, Server or Client-side? I had this question for many time, and I after learn I forgot all points when the other developers have asked me about it. So I decided to list all on this simple list below and adding the Local Compilation too. A disclaimer, I ever use server-side compilation on the admin panel and local compilation on my local environment. ;)

You can find this configuration on Store > Configuration > Advanced > Developer > Frontend Development Workflow.

Server-Side compilation

The server-side compilation is the default choice, used for first-time compilation after setup and for production mode.

Cons:

  • Slow
  • Global recompile
  • Need to delete static files before each run

Pros:

  • No additional setup required
  • Works on the server side

Client-Side compilation

Client-side compilation with Javascript is optional and is used to quickly preview changes and debug small issues.

Cons:

  • Annoying blinking before styles compile
  • Global recompile

Pros:

  • No need for additional setup, can be switched in the Admin area
  • Fast

Local compilation

Local compilation with Node.js and Grunt task runner is an advanced mode recommended for deep customization.

Cons:

  • Requires initial setup of the local environment

Pros:

  • Fast
  • Recompiles only local changes
  • Easy to debug
  • Can be automated with watching and live to reload

I hope that this explanation helps you with your projects, I would like to know which you prefer, and why? Tell me in the comments.

More from this blog

R

Rafael Corrêa Gomes - Ecommerce Developer

31 posts

Escrevo sobre desenvolvimento, e-commerce, Shopify, Magento, produtividade e carreira profissional.