LWC1513: @salesforce/resourceUrl modules only support default imports
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
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:
- A javascript file
- 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
add a comment |
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:
- A javascript file
- 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
remove the curly braces around Library
– glls
May 12 at 14:04
add a comment |
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:
- A javascript file
- 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
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:
- A javascript file
- 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
lightning-web-components static-resources
asked May 12 at 13:37
AneeAnee
99110
99110
remove the curly braces around Library
– glls
May 12 at 14:04
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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
add a comment |
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
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
add a comment |
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
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
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
remove the curly braces around Library
– glls
May 12 at 14:04