output.emitAssets

  • Type:
type EmitAssets = (params: { target: RsbuildTarget }) => boolean;
  • Default: () => true

Control whether to emit static assets such as images, fonts, audio, video, etc.

In scenarios such as SSR, you may not need to emit duplicate static assets. Therefore, you can return false in emitAssets to emitting assets.

Example

For example, the following example will emit static assets when building web bundles, and avoid emitting when building node bundles.

export default {
  output: {
    targets: ['web', 'node'],
    emitAssets: ({ target }) => target !== 'node',
  },
};
ON THIS PAGE