2

I read the following documentation where it clearly says that under Production mode,

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.

so custom component code is not minified or obfuscated in production mode. Is there any other way to make it possible? The issue is that when I use Developer tools of Chrome and navigate to Source tab, JS code of individual Lightning component is properly formatted and readable.

https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/aura_debug_mode.htm

5

I would wager that obfuscation of your Lightning code probably shouldn't matter in most cases; a typical Lightning controller is just doing things like getting data from the server and sending data back, toggling classes, etc. Most of your IP that you'd want to protect would likely be in Apex Code, which is obfuscated. Ultimately, the code needs to be readable by the browser, so even obfuscation of the code would slow down or deter those that are merely curious; if someone wants to reverse engineer your code, there's nothing that can truly be done about it, since it's only a matter of time before they will be able to figure things out. Truth be told, if I were curious about your code, obfuscation wouldn't keep me from trying to figure out what's going on anyways. Things like encryption, accessing remote services, secrets (keys, etc) anything you care about from being protected should not be placed in JavaScript, but instead only used in Apex Code.

2

At this point lightning component code is not obfuscated in production but it seems to be on the future road map. To what level it will be obfuscated and when it will done is there to be seen.

There are lot of open source javascript obfuscators avaliable one of them link here. This needs testing and very careful consideration since in lightning components we have method references in markup, and helper method references in controllers. Also when you use inheritance the methods are called from child components. There are just some examples.

I would say needs lot of testing and careful dry run before you can deploy it to production.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.