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/rspeedy/rspeedy.source.transformimport.md.
Rspeedy logo
Rspeedy
  • English
  • Home > @lynx-js/rspeedy > Source > transformImport

    Source.transformImport property

    The TransformImport option transforms the import paths to enable modular imports from subpaths of third-party packages, similar to the functionality provided by babel-plugin-import.

    Signature:

    transformImport?: TransformImport[] | undefined;

    Default Value

    undefined

    Example

    When using the TUX component library, you can import components on demand with the following config:

    import { defineConfig } from '@lynx-js/rspeedy'
    
    export default defineConfig({
      source: {
        transformImport: [
          {
            libraryName: 'foo',
            customName: 'foo/src/components/{{ member }}/{{ member }}',
          },
        ],
      },
    })

    This will transform the following source code:

    import { Button } from 'foo'

    to:

    import { Button } from 'foo/src/components/Button/Button'
    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.