I am trying to import a custom object and I am getting the following error

'LWC1513: @salesforce/schema modules only support default imports'

here is my code for my js file.

import { LightningElement,api } from 'lwc';
import { StreetAddress } from "@salesforce/schema/Retail_Account__c.Address__c";
import { CityAddress } from "@salesforce/schema/Retail_Account__c.City__c";
import { StateAddress } from "@salesforce/schema/Retail_Account__c.State__c";
import { RetalName } from "@salesforce/schema/Retail_Account__c.Name"

export default class RetailMapSingleMarker extends LightningElement {
    @api RecordId 
    @api objectApiName

    mapMarkers = [
            location: {
                Street: StreetAddress,
                City: CityAddress,
                State: StateAddress,

            title: RetalName


When you say import { RetalName } - this is called Named Import. This is not valid for @salesforce/schema modules since they are default exports. You need to use below:

import RETAIL_ACCOUNT_NAME from "@salesforce/schema/Retail_Account__c.Name"

This means, you are importing default Retail_Account__c.Name and assigning it to variable RETAIL_ACCOUNT_NAME.


You can use Named imports for a module like below:

const getTermOptions = () => {
    return [
        { label: '20 years', value: 20 },
        { label: '25 years', value: 25 },

const calculateMonthlyPayment = (principal, years, rate) => {
    // Logic

export { getTermOptions, calculateMonthlyPayment };

Here, you are exporting getTermOptions and calculateMonthlyPayment functions. So, you can import them by Name as below.

import { getTermOptions, calculateMonthlyPayment } from 'c/your_module'

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.