This is a bit tricky Exercise .In fact the error gives an idea on why this showing up .When you have implemented a lightning Interface of AllPageTypes which means you cannot get rid of design file attributes
Step 0 - you might have to delete Lightning Pages that make reference to the component. Otherwise Salesforce might show an error when you try to remove the interface (or fields).
Step 1 - Lets remove the Interface from your code first ,so try removing the implements attribute
<aura:component controller="FormController" access="global">
<aura:attribute name="taxRate" type="String" access="global"/>
....
</aura:component>
Step 2 - Remove the Design attribute now .
Step 3 - Remove the Attribute once you have removed the designed reference
Step 4 - Add the implements and other code back .
I have made a blog about how to resolve this issue without having to add a design attribute. Link:
http://kevansfdc.blogspot.com/2017/02/does-lightning-component-know-if-it-is.html
The solution I propose is to use a aura enabled method which return whether you are in a site context using the Site class that come natively with Salesforce.
@AuraEnabled
public static boolean isCommunity(){
Id siteId = Site.getSiteId(); // take a look at the apex class Site, you may find more useful method concerning site/community
if (siteId != null) {
return true;
}
return false;
}
And simply calling this method through an action in Lightning.
var action = component.get("c.isCommunity");
action.setCallback(this, function(response) {
var isCommunity = response.getReturnValue(); // do any operation needed here
});
$A.enqueueAction(action);
Hope this is useful as an answer. Cheers!
Best Answer
As the error states, you can't remove a design attribute that previously existed in an older version. This is because it could break existing implementations that depend on this attribute. This is similar to how you cannot delete a global class or an unprotected workflow element. These restrictions prevent the system from breaking as a result of an upgrade. Your only choice here is to document that the attribute is no longer used. Note that the Known Issue you linked referred to a different problem; it occurred upon upgrade (e.g. in a subscriber org), not during an upload (from the developer org).