output.manifest

  • Type: string | boolean
  • Default: false

Whether to generate a manifest file that contains information of all assets, and the mapping relationship between entry module and assets.

When output.manifest is set to true, Rsbuild will generate a manifest.json file after building. When the value of output.manifest is a string, it will be used as the manifest file name or path.

Output

The default output file structure of manifest is:

type FilePath = string;

type ManifestList = {
  entries: {
    /** The key is the entry name, from Rsbuild's source.entry config. */
    [entryName: string]: {
      initial?: {
        js?: FilePath[];
        css?: FilePath[];
      };
      async?: {
        js?: FilePath[];
        css?: FilePath[];
      };
      /** html files related to the current entry */
      html?: FilePath[];
      /** other assets (e.g. png、svg、source map) related to the current entry */
      assets?: FilePath[];
    };
  };
  /** Flatten all assets */
  allFiles: FilePath[];
};

Basic Example

Enable asset manifest:

export default {
  output: {
    manifest: true,
  },
};

After building, there will be a dist/manifest.json file:

{
  "allFiles": [
    "/static/css/index.a11cfb11.css",
    "/static/js/index.c586cd5e.js",
    "/index.html",
    "/static/js/index.c586cd5e.js.LICENSE.txt"
  ],
  "entries": {
    "index": {
      "initial": {
        "js": ["/static/js/index.c586cd5e.js"],
        "css": ["/static/css/index.a11cfb11.css"]
      },
      "assets": ["/static/js/index.c586cd5e.js.LICENSE.txt"],
      "html": ["/index.html"]
    }
  }
}

Set Path

output.manifest can be a path relative to the dist directory, for example, output to dist/static/my-manifest.json:

export default {
  output: {
    manifest: './static/my-manifest.json',
  },
};