DEV Community

Cover image for Magento 2 Compiling on server or client side? (Pros and Cons)
Rafael Corrêa Gomes
Rafael Corrêa Gomes

Posted on • Edited on • Originally published at blog.rafaelcg.com

2

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

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. 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 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 server side

Client-Side compilation

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

Cons:

  • Annoying blinking before styles compile
  • Global recompile

Pros:

  • No need for additional setup, can be switched in 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 local environment

Pros:

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

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

Image of Datadog

The Future of AI, LLMs, and Observability on Google Cloud

Datadog sat down with Google’s Director of AI to discuss the current and future states of AI, ML, and LLMs on Google Cloud. Discover 7 key insights for technical leaders, covering everything from upskilling teams to observability best practices

Learn More

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →