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
several 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 with images intended to be used offline, we recommend the first two options. Static resources support offline images, but with limitations.