Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix(bundler-okam): prefer use lessLoader.modifyVars than theme #874

Merged
merged 1 commit into from
Jan 17, 2024

Conversation

sorrycc
Copy link
Member

@sorrycc sorrycc commented Jan 17, 2024

问题

mako 不兼容 umi 的使用方式,不支持 lessLoader.modifyVars。

分析

原有逻辑见 https://github.com/umijs/umi/blob/cd327af/packages/bundler-webpack/src/config/cssRules.ts#L26-L28

lessOptions: {
  modifyVars: userConfig.theme,
  ...userConfig.lessLoader,
},

一个细节是,如果 lessLoader 下有配置 modifyVars,会覆盖 userConfig.theme 里的定义。所以这里有个选择,1)保持一致,2)改成扩展的形式,让 lessLoader.modifyVars 扩展 userConfig.theme。虽然感觉后者更好,但还是先保持一致吧,用 lessLoader.modifyVars 的毕竟少。

方案

修改 bundler-okam/index.js,逻辑如下。

modifyVars: opts.config.lessLoader?.modifyVars || opts.config.theme,

@sorrycc sorrycc merged commit 98d0e6b into master Jan 17, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the sorrycc-3ovo branch January 17, 2024 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant