Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

bug: ambiguous css modules #1677

Open
PeachScript opened this issue Nov 5, 2024 · 0 comments
Open

bug: ambiguous css modules #1677

PeachScript opened this issue Nov 5, 2024 · 0 comments
Assignees

Comments

@PeachScript
Copy link
Member

PeachScript commented Nov 5, 2024

同一段代码:

.foo {
  &:global.bar {
    color: #fff;
    .hey {
      color: #fff;
    }
  }
}

mako@0.8.x 中会编译成:

.foo-xxx.bar {
  color: #fff;
}
.foo-xxx.bar .hey {
  color: #fff;
}

但在 mako@0.9.x 中会编译成:

.foo-xxx.bar-yyy {
  color: #fff;
}
.foo-xxx.bar-yyy .hey {
  color: #fff;
}

:global.xx 并非 CSS Modules 文档中提到的用法,不知道是否是 undefined behavior,需要对比 css-loader 来确认是 SWC CSS 的 bug 还是规范以外的用法,以及确认实现同等语义的正确范式应该是怎样的。

另外 mako@0.9.x 还有一些『诡异』(不确定正确结果应该是什么)的行为,比如:

.foo {
  :global {
    &.bar {
      color: #fff;
    }
  }
}
// 会被编译成
.foo-yyy {
 color: #fff;
}
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants