For AI agents: the complete documentation index is available at /next/zh/llms.txt, the full documentation bundle is available at /next/zh/llms-full.txt, and this page is available as Markdown at /next/zh/api/rspeedy/rspeedy.output.assetprefix.md.
Rspeedy logo
Rspeedy
  • 简体中文
  • 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;

    Default Value

    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/',
      },
    })
    除非另有说明,本项目采用知识共享署名 4.0 国际许可协议进行许可,代码示例采用 Apache License 2.0 许可协议进行许可。