Home > @lynx-js/rspeedy > Output > assetPrefix

Output.assetPrefix property

The Output.assetPrefix is used to set the URL prefix for static assets.

Signature:

assetPrefix?: string | undefined;

Remarks

The functionality of Output.assetPrefix is basically the same as the output.publicPath config in Rspack. With the following differences:

  • output.assetPrefix only takes effect in the production build.

  • output.assetPrefix automatically appends a trailing / by default.

  • The value of output.assetPrefix is written to the process.env.ASSET_PREFIX environment variable.

Example

import { defineConfig } from '@lynx-js/rspeedy'
export default defineConfig({
  output: {
    assetPrefix: 'https://cdn.example.com/assets/',
  },
})
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.