Skip to content

[Bug]: & operator is not working in less module #4405

Closed
@gz65555

Description

@gz65555

Version

System:
  OS: Linux 6.1 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
  CPU: (32) x64 13th Gen Intel(R) Core(TM) i9-13900K
  Memory: 44.37 GB / 62.38 GB
  Container: Yes
  Shell: 5.8 - /usr/bin/zsh
Browsers:
  Chrome: 131.0.6778.204
npmPackages:
  @rsbuild/core: ^1.1.8 => 1.1.14 
  @rsbuild/plugin-less: ^1.1.0 => 1.1.0 
  @rsbuild/plugin-react: ^1.0.7 => 1.1.0

Details

This is the original code of less.

.test {
  background-color: rebeccapurple;
}
:global(.hello) {
  background-color: aqua;

  &-world {
    background-color: brown;
  }
}

When I used the & operator, the built output did not include the class modified by &. The output is:

.test-vRkBOC{background-color:#639}.hello{background-color:#0ff}

Reproduce link

https://codesandbox.io/p/github/gz65555/rsbuild-less-bug-feedback/main?import=true

Reproduce Steps

  1. Run pnpm i & pnpm build
  2. Check the output folder and open the css file

You can see there is no .hello-world class here

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions