I have Apex Controller Class, say, LWCController
and several methods inside of it, let's say Method1
, Method2
, Method3
, Method4
, Method5
.
Use default import syntax to import an Apex method via the @salesforce/apex scoped packages.
Default import syntax allows to imports several items from the same module
import { export1 , export2 } from "module-name"; import { foo , bar } from "module-name/path/to/specific/un-exported/file"; import { export1, export2 as alias2 , [...] } from "module-name"; import defaultExport, { export [ , [...] ] } from "module-name";
I am trying to import all of them simultaneously at the same line
import {Method1, Method2, Method3, Method4, Method5 } from '@salesforce/apex/LWCController';
And I receive the following errors
=== Deploy Errors PROJECT PATH ERRORS N/A [Line: 2, Col: 118] LWC1501: @salesforce/apex modules should have both class and method names. N/A LWC1513: @salesforce/apex modules only support default imports.
import {Method1, Method2, Method3, Method4, Method5 } from '@salesforce/apex/LWCController';
how will SF know which alias to use for which method? WHat if there are 10 methods in class and you importing 5 ? – Pranay Jaiswal Mar 19 '19 at 9:57