Newer Version Available
Use Images in an LWC Offline-Enabled Component
Lightning Web Components supports multiple ways of referencing graphics assets in a
component. Not all of these methods work when the component runs offline. LWC Offline supports two
methods of referencing images in your offline-ready Lightning web components.
The standard methods for referencing images (and other binary assets) in an LWC are:
- Images uploaded as Files, using the VersionDataUrl field of the latest ContentVersion related to a particular ContentDocument record.
- Content Assets, using the @salesforce/contentAssetUrl module.
- Static Resources, using the @salesforce/resourceUrl module.
For LWCs intended to be used offline, consider only the first two options. Static resources aren’t supported for offline use at this time.