-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get asset from js file #109
Comments
Hey, You should be able to do something like this: import myImage from '../../images/my_image.svg'
export () => {
const img = document.querySelector('img')
img.src = myImage
} Images are ran through the file-loader so Feel free to re-open this issue if it's still not working for you, and please include a bit more information as to what is not working specifically, any errors in the console or the terminal output. |
HI, in development enviroment works perfectly ( linking to https://localhost:8080 ) thanks f |
That seems right, as far as I know, there is no way to get the Shopify CDN url in JavaScript. Maybe @t-kelly has an idea on how to retrieve it ? |
You can add something like this to the
And then refer to the image URL as |
Hi,
how can i refer an image asset from the asset/images folder in my js code ?
i can have it working in dev mode with
{require("../../images/my_image.svg")}
but no luck in production
thanks
The text was updated successfully, but these errors were encountered: