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/react-rsbuild-plugin/interfaces/ShakeVisitorConfig.md.
Lynx
  • English
  • Interface: ShakeVisitorConfig

    How main-thread code will be shaken.

    Properties

    pkgName

    pkgName: string[]

    Package names to identify runtime imports that need to be processed

    Example

    import { defineConfig } from '@lynx-js/rspeedy'
    import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
    
    export default defineConfig({
      plugins: [
        pluginReactLynx({
          shake: {
            pkgName: ['@lynx-js/react-runtime']
          }
        })
      ]
    })

    Default Value

    ['@lynx-js/react-runtime']

    Remarks

    The provided values will be merged with the default values instead of replacing them.


    removeCall

    removeCall: string[]

    Function names whose calls should be replaced with undefined during transformation

    Example

    import { defineConfig } from '@lynx-js/rspeedy'
    import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
    
    export default defineConfig({
      plugins: [
        pluginReactLynx({
          shake: {
            removeCall: ['useMyCustomEffect']
          }
        })
      ]
    })

    Default Value

    ['useEffect', 'useLayoutEffect', '__runInJS', 'useLynxGlobalEventListener', 'useImperativeHandle']

    Remarks

    The provided values will be merged with the default values instead of replacing them.


    removeCallParams

    removeCallParams: string[]

    Function names whose parameters should be removed during transformation

    Example

    import { defineConfig } from '@lynx-js/rspeedy'
    import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
    
    export default defineConfig({
      plugins: [
        pluginReactLynx({
          shake: {
            removeCallParams: ['useMyCustomEffect']
          }
        })
      ]
    })

    Default Value

    []

    Remarks

    The provided values will be merged with the default values instead of replacing them.


    retainProp

    retainProp: string[]

    Properties that should be retained in the component class

    Example

    import { defineConfig } from '@lynx-js/rspeedy'
    import { pluginReactLynx } from '@lynx-js/react-rsbuild-plugin'
    
    export default defineConfig({
      plugins: [
        pluginReactLynx({
          shake: {
            retainProp: ['myCustomMethod']
          }
        })
      ]
    })

    Default Value

    ['constructor', 'render', 'getDerivedStateFromProps', 'state', 'defaultDataProcessor', 'dataProcessors', 'contextType', 'defaultProps']

    Remarks

    The provided values will be merged with the default values instead of replacing them.

    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.