I'm developing some lightning-web-components for a managed package with namespace example7
. For all my previous dev work on this managed package, I was using aura rather than lwc, and developing in a non-namespaced scratch org.
With LWC, now that we can import the apex methods into the js file, I'm unsure how to handle the namespace. The docs say:
import apexMethod from '@salesforce/apex/Namespace.Classname.apexMethod'
... and when deployed in the managed package that would be...
import apexMethod from '@salesforce/apex/example7.Classname.apexMethod'
So, my questions:
- do I hardcode the
example7
namespace into the code of the js file? - does that mean I need to be developing in a namespaced scratch org?
- do I similarly need to hardcode the namespace into the api-object-name in things like lightning-record-edit?