For AI agents: the complete documentation index is available at /next/llms.txt, the full documentation bundle is available at /next/llms-full.txt, and this page is available as Markdown at /next/api/packages/rspeedy/functions/defineConfig.md.
Lynx
  • English
  • Function: defineConfig()

    Call Signature

    defineConfig(config: Config): Config

    The defineConfig method is a helper function used to get TypeScript intellisense.

    Parameters

    ParameterTypeDescription
    configConfigThe config of Rspeedy.

    Returns

    Config

    The identical config as the input config.

    Example

    Use defineConfig in lynx.config.ts:

    import { defineConfig } from '@lynx-js/rspeedy'
    export default defineConfig({
      // autocompletion works here!
    })

    Call Signature

    defineConfig(config: (params: ConfigParams) => Config): (params: ConfigParams) => Config

    The defineConfig method is a helper function used to get TypeScript intellisense.

    Parameters

    ParameterTypeDescription
    config(params: ConfigParams) => ConfigThe function that returns a config of Rspeedy.

    Returns

    The identical function as the input.

    (params: ConfigParams) => Config

    Examples

    Use defineConfig in lynx.config.ts:

    import { defineConfig } from '@lynx-js/rspeedy'
    export default defineConfig(() => {
      return {
        // autocompletion works here!
      }
    })

    Use defineConfig with parameters in lynx.config.ts:

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig(({ env }) => {
      const isTest = env === 'test'
      return {
        output: {
          minify: isTest ? false : true,
        },
      }
    })

    Call Signature

    defineConfig(config: Promise<Config>): Promise<Config>

    The defineConfig method is a helper function used to get TypeScript intellisense.

    Parameters

    ParameterTypeDescription
    configPromise<Config>The promise that resolves to a config of Rspeedy.

    Returns

    Promise<Config>

    The identical promise as the input.

    Example

    Use defineConfig in lynx.config.ts:

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig(
      import('@lynx-js/react-rsbuild-plugin').then(({ pluginReactLynx }) => ({
        plugins: [pluginReactLynx()],
      })),
    );

    Call Signature

    defineConfig(config: (params: ConfigParams) => Promise<Config>): (params: ConfigParams) => Promise<Config>

    The defineConfig method is a helper function used to get TypeScript intellisense.

    Parameters

    ParameterTypeDescription
    config(params: ConfigParams) => Promise<Config>The function that returns a promise that resolves to a config of Rspeedy.

    Returns

    The identical function as the input.

    (params: ConfigParams) => Promise<Config>

    Examples

    Use defineConfig in lynx.config.ts:

    import { defineConfig } from '@lynx-js/rspeedy'
    export default defineConfig(async () => {
      const foo = await bar()
      return {
        // autocompletion works here!
      }
    })

    Use defineConfig with parameters in lynx.config.ts:

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig(async ({ env }) => {
      const foo = await bar()
      const isTest = env === 'test'
      return {
        output: {
          minify: isTest ? false : true,
        },
      }
    })
    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.