KC's Workspace
    Preparing search index...
    interface CssOptions {
        fileName?: string;
        inject?: boolean;
        lightningcss?: LightningCSSOptions;
        minify?: boolean;
        modules?: false | CSSModulesOptions;
        postcss?: PostCSSOptions;
        preprocessorOptions?: PreprocessorOptions;
        splitting?: boolean;
        target?: string | false | string[];
        transformer?: "postcss" | "lightningcss";
    }
    Index
    fileName?: string

    Specify the name of the CSS file generated when splitting is false.

    'style.css'
    
    inject?: boolean

    When enabled, JS output preserves import statements pointing to emitted CSS files. Consumers of the library will automatically import the CSS alongside the JS.

    false
    
    lightningcss?: LightningCSSOptions

    Lightning CSS options for CSS syntax lowering and transformations.

    minify?: boolean

    Enable/disable CSS minification.

    false
    
    modules?: false | CSSModulesOptions

    CSS modules configuration. When not false, .module.css files (and preprocessor variants) are treated as CSS modules with scoped class names.

    postcss?: PostCSSOptions

    PostCSS configuration.

    • string: Path to the directory to search for PostCSS config files.
    • object: Inline PostCSS options with optional plugins array.
    • Omitted: Auto-detect PostCSS config from the project root.

    Only used when transformer is 'postcss'. Requires postcss to be installed.

    preprocessorOptions?: PreprocessorOptions

    Options for CSS preprocessors (Sass/Less/Stylus).

    In addition to options specific to each processor, additionalData option can be used to inject extra code for each style content.

    splitting?: boolean

    Enable/disable CSS code splitting. When set to false, all CSS in the entire project will be extracted into a single CSS file named by fileName. When set to true, CSS imported in async JS chunks will be preserved as chunks.

    Defaults to false, but if unbundle is true, it defaults to true to preserve chunk splitting.

    target?: string | false | string[]

    Set the target environment for CSS syntax lowering. Accepts esbuild-style target strings (e.g., 'chrome99', 'safari16.2'). Defaults to the top-level target option.

    tsdownConfig.target
    
    transformer?: "postcss" | "lightningcss"

    CSS transformer to use. Controls how CSS is processed:

    • 'lightningcss' (default): @import handled by Lightning CSS bundleAsync(), PostCSS is not used at all.
    • 'postcss': @import handled by postcss-import, PostCSS plugins applied, Lightning CSS used only for final targets/minify transform.