I am aware that lightning components already run in production mode. And the code when using a managed packages would be obfuscated. And also that lightning framework uses heavy caching unless explicitly set to false. So salesforce is already trying to run our code in a secure and optimised way.

However, I am curious if minification would help improve the performance as in any javascript library? I mean minified code = less number of white spaces = lesser time to load.

I tried minifying a sample controller and helper. Though it did not make much of a difference. What happens to our controllers and helpers when it is being passed to the aura framework?

We are passing a JSON object with methods to the helper and controller methods,

   Method1 : function(),
   Method2 : function()

does the framework minify the code and abstract the methods? like change the methodName from getSomething() to gs() so that it would save literals ? Or I am wrong in assuming minification would help in increasing the performance.

Any insights. ?

  • 1
    Just fyi - currently this is NOT the case for lightning components code - "And the code when using a managed packages would be obfuscated"
    – Eric
    May 11, 2017 at 0:46

2 Answers 2


Yes it does.


There are two modes: production and debug. By default, the Lightning Component framework runs in production mode. This mode is optimized for performance. It uses the Google Closure Compiler to optimize and minimize the size of the JavaScript code. The method names and code are heavily obfuscated.

So you don't need to try to minify yourself - just turn on or off debug mode in the lightning settings.

Source: Here

  • @CasperHarmer - This The method names and code are heavily obfuscated is currently not correct - salesforce.stackexchange.com/questions/173269/…
    – Eric
    May 11, 2017 at 0:47
  • Only with reference to a managed package - ie you can turn it obfuscation on and off and the creator of the package can't prevent this. I'm pretty sure that it's all dependent on setting debug mode - the beef with that question was the ability to override this setting, which can't currently be done. May 11, 2017 at 0:54
  • Just a small note on the side when using debug mode: some exceptions are raised to the interface when debug mode is enabled which is not the case in production mode: salesforce.stackexchange.com/questions/177601/… Jun 12, 2017 at 17:34

Although, this response is late, it might help someone searching for Salesforce JS minification. As mentioned here, Salesforce performs minification only on the framework code and not on custom component.

Optimization and minification are performed on framework code only. Custom component code is not minified or obfuscated. Untouched custom component code includes both components you create yourself, and components installed as part of a managed package.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .