web-infra-dev / rspack

The fast Rust-based web bundler with webpack-compatible API 🦀️
https://rspack.dev
MIT License
10.05k stars 573 forks source link

[Bug]: CSS output extra details about lang(*) dir(*) #8405

Open 1yasa opened 1 week ago

1yasa commented 1 week ago

System Info

System: OS: macOS 14.4 CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900KF Memory: 6.79 GB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.8.0 - /usr/local/bin/node npm: 10.8.2 - /usr/local/bin/npm pnpm: 9.9.0 - /usr/local/bin/pnpm bun: 1.1.24 - /usr/local/bin/bun Watchman: 2024.06.10.00 - /usr/local/bin/watchman

Details

After update to rsapck version > 0.1.4 , build app then output css that has extra unnessary content:

Image

Here is the origin css:

.__editor_block_special {
    padding-inline-start: 0;
    padding-inline-end: 0;
    margin-inline-start: var(--editor_padding_x);
    margin-inline-end: var(--editor_padding_x);
}

Tried custom LightningCssMinimizerRspackPlugin options:

optimization: {
    minimizer: [
        new LightningCssMinimizerRspackPlugin({
            minimizerOptions: {
                exclude: {
                    langSelectorList: true,
                    dirSelector: true
                }
            }
        })
    ]
}

Still dir selector exsit:

Image

Temp resolution is downgrading rspack version to 1.0.4 or set targets to chrome >= 120:

optimization: {
    minimizer: [
        new LightningCssMinimizerRspackPlugin({
            minimizerOptions: {
                targets: 'chrome >= 120'
            }
        })
    ]
}

Reproduce link

No response

Reproduce Steps

see above.

inottn commented 1 week ago

Refer to https://github.com/web-infra-dev/rspack/pull/7811.

1yasa commented 1 week ago

Refer to #7811.

Seem not to solve the problem for default downgrade application css. This default behavior is unacceptable.