Assets loader allows you to use images in your application as well as to reference other static assets (video, audio, etc).
By default, Assets loader extracts asset files, meaning the files will be copied to the output directory and included in the final application as individual files. The assets files are put in target location depending on the platform:
assets/
directorydrawable-*
directoriesThis behavior is in line with how Metro handles assets. The default Webpack template has Assets Loader configured to process the same assets types as Metro.
Assets Loader in Re.Pack also has some additional capabilities like inlining assets as base64
encoded data URI or converting the assets to be downloadable from a remote server, you can read more about them here:
If you want to use SVGs in your application, check out dedicated guide on SVGs.
Assets Loader should be used in combination with AssetsResolverPlugin
to work correctly and process scales like @1x
, @2x
and so on. If you are using RepackPlugin
you don't need to do anything, as it's already included there.
In some cases, you might want to exclude assets from being processed by Re.Pack's Assets Loader. A typical scenario would be if you want to manually process specific assets separately using different loaders — a common example of such scenario would be SVGs.
You can exclude asset types by filtering them out from ASSET_EXTENSIONS
array:
Then add your own rule and loader to process the excluded asset: