Static Assets
Farm treat modules that is not treated as code as Static Assets, for example, images like png/svg/etc, text files like txt/xlsx/etc. This document describes how Farm deal with these assets.
url
Import a image:
Default to use url method when import a image. When using url methods to import a image, the image will be emitted to the output dir directly, and the image module itself will be compiled to a js module like:
using compilation.output.assetFilename to config your asset name。
inline
Using query ?inline to tell Farm that you want to inline your assets,then the assets will be transformed to base64,for example:
raw
Using query ?raw to tell Farm that you want to read the raw string of the assets, for example
Configuring Assets
- Using
compilation.output.assetFileNameto control the production file name - using
compilation.assets.includeto treat more kind of files as asset modules.
