LWC1513: @salesforce/resourceUrl modules only support default imports





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







3















I am trying to import a 3rd party javascript library into my LWC and everytime I try to push the code to my Scratch Org, I get the below error.




LWC1513: @salesforce/resourceUrl modules only support default imports.




The library consists to 2 files:




  1. A javascript file

  2. A CSS file


I have zipped these 2 files into one and uploaded them as a static resource. I use the below code in the js file of my LWC:



import { Library } from '@salesforce/resourceUrl/CustomLibrary';


The static resource has the name 'CustomLibrary' in my org. The push succeeds without this line of code though. I spent enough time to figure out what is going wrong but with little success.



I came across a similar link on Stack Overflow, but that didn't help me either.










share|improve this question























  • remove the curly braces around Library

    – glls
    May 12 at 14:04




















3















I am trying to import a 3rd party javascript library into my LWC and everytime I try to push the code to my Scratch Org, I get the below error.




LWC1513: @salesforce/resourceUrl modules only support default imports.




The library consists to 2 files:




  1. A javascript file

  2. A CSS file


I have zipped these 2 files into one and uploaded them as a static resource. I use the below code in the js file of my LWC:



import { Library } from '@salesforce/resourceUrl/CustomLibrary';


The static resource has the name 'CustomLibrary' in my org. The push succeeds without this line of code though. I spent enough time to figure out what is going wrong but with little success.



I came across a similar link on Stack Overflow, but that didn't help me either.










share|improve this question























  • remove the curly braces around Library

    – glls
    May 12 at 14:04
















3












3








3








I am trying to import a 3rd party javascript library into my LWC and everytime I try to push the code to my Scratch Org, I get the below error.




LWC1513: @salesforce/resourceUrl modules only support default imports.




The library consists to 2 files:




  1. A javascript file

  2. A CSS file


I have zipped these 2 files into one and uploaded them as a static resource. I use the below code in the js file of my LWC:



import { Library } from '@salesforce/resourceUrl/CustomLibrary';


The static resource has the name 'CustomLibrary' in my org. The push succeeds without this line of code though. I spent enough time to figure out what is going wrong but with little success.



I came across a similar link on Stack Overflow, but that didn't help me either.










share|improve this question














I am trying to import a 3rd party javascript library into my LWC and everytime I try to push the code to my Scratch Org, I get the below error.




LWC1513: @salesforce/resourceUrl modules only support default imports.




The library consists to 2 files:




  1. A javascript file

  2. A CSS file


I have zipped these 2 files into one and uploaded them as a static resource. I use the below code in the js file of my LWC:



import { Library } from '@salesforce/resourceUrl/CustomLibrary';


The static resource has the name 'CustomLibrary' in my org. The push succeeds without this line of code though. I spent enough time to figure out what is going wrong but with little success.



I came across a similar link on Stack Overflow, but that didn't help me either.







lightning-web-components static-resources






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked May 12 at 13:37









AneeAnee

99110




99110













  • remove the curly braces around Library

    – glls
    May 12 at 14:04





















  • remove the curly braces around Library

    – glls
    May 12 at 14:04



















remove the curly braces around Library

– glls
May 12 at 14:04







remove the curly braces around Library

– glls
May 12 at 14:04












1 Answer
1






active

oldest

votes


















6














Default imports dont use curly braces, therefore, your import would be as follows:



import Library from '@salesforce/resourceUrl/CustomLibrary';



this is standard across library imports from the static resource library.



for a more in depth explanation, you can refer to the Javascript Reference documentation



and the LWC Documentation on Accessing Static Resources






share|improve this answer


























  • Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

    – sfdcfox
    May 12 at 15:36











  • yup - included the link as well. Thanks!

    – glls
    May 12 at 16:21











  • Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

    – Anee
    May 13 at 6:42












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f262070%2flwc1513-salesforce-resourceurl-modules-only-support-default-imports%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









6














Default imports dont use curly braces, therefore, your import would be as follows:



import Library from '@salesforce/resourceUrl/CustomLibrary';



this is standard across library imports from the static resource library.



for a more in depth explanation, you can refer to the Javascript Reference documentation



and the LWC Documentation on Accessing Static Resources






share|improve this answer


























  • Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

    – sfdcfox
    May 12 at 15:36











  • yup - included the link as well. Thanks!

    – glls
    May 12 at 16:21











  • Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

    – Anee
    May 13 at 6:42
















6














Default imports dont use curly braces, therefore, your import would be as follows:



import Library from '@salesforce/resourceUrl/CustomLibrary';



this is standard across library imports from the static resource library.



for a more in depth explanation, you can refer to the Javascript Reference documentation



and the LWC Documentation on Accessing Static Resources






share|improve this answer


























  • Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

    – sfdcfox
    May 12 at 15:36











  • yup - included the link as well. Thanks!

    – glls
    May 12 at 16:21











  • Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

    – Anee
    May 13 at 6:42














6












6








6







Default imports dont use curly braces, therefore, your import would be as follows:



import Library from '@salesforce/resourceUrl/CustomLibrary';



this is standard across library imports from the static resource library.



for a more in depth explanation, you can refer to the Javascript Reference documentation



and the LWC Documentation on Accessing Static Resources






share|improve this answer















Default imports dont use curly braces, therefore, your import would be as follows:



import Library from '@salesforce/resourceUrl/CustomLibrary';



this is standard across library imports from the static resource library.



for a more in depth explanation, you can refer to the Javascript Reference documentation



and the LWC Documentation on Accessing Static Resources







share|improve this answer














share|improve this answer



share|improve this answer








edited May 12 at 19:59

























answered May 12 at 14:10









gllsglls

12.3k72453




12.3k72453













  • Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

    – sfdcfox
    May 12 at 15:36











  • yup - included the link as well. Thanks!

    – glls
    May 12 at 16:21











  • Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

    – Anee
    May 13 at 6:42



















  • Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

    – sfdcfox
    May 12 at 15:36











  • yup - included the link as well. Thanks!

    – glls
    May 12 at 16:21











  • Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

    – Anee
    May 13 at 6:42

















Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

– sfdcfox
May 12 at 15:36





Also, LWC docs: developer.salesforce.com/docs/component-library/documentation/…

– sfdcfox
May 12 at 15:36













yup - included the link as well. Thanks!

– glls
May 12 at 16:21





yup - included the link as well. Thanks!

– glls
May 12 at 16:21













Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

– Anee
May 13 at 6:42





Thanks @glls, it helped me resolve my issue. So silly of me. I knew it had to be something very simple. I wish I had figured it out on my own.

– Anee
May 13 at 6:42


















draft saved

draft discarded




















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f262070%2flwc1513-salesforce-resourceurl-modules-only-support-default-imports%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

He _____ here since 1970 . Answer needed [closed]What does “since he was so high” mean?Meaning of “catch birds for”?How do I ensure “since” takes the meaning I want?“Who cares here” meaningWhat does “right round toward” mean?the time tense (had now been detected)What does the phrase “ring around the roses” mean here?Correct usage of “visited upon”Meaning of “foiled rail sabotage bid”It was the third time I had gone to Rome or It is the third time I had been to Rome

Bunad

Færeyskur hestur Heimild | Tengill | Tilvísanir | LeiðsagnarvalRossið - síða um færeyska hrossið á færeyskuGott ár hjá færeyska hestinum