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

[Feature]关于WebpackPluginFrTheme #52

Closed
phoema opened this issue Dec 30, 2019 · 4 comments
Closed

[Feature]关于WebpackPluginFrTheme #52

phoema opened this issue Dec 30, 2019 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@phoema
Copy link

phoema commented Dec 30, 2019

希望能够增加umijs中导入WebpackPluginFrTheme的样例。

我使用的是and pro和umijs,我应该如何定义WebpackPluginFrTheme,我尝试在
plugins中直接增加如umi-plugin-pro-bloc的格式,但是会报错。
[
'umi-plugin-pro-block',
{
moveMock: false,
moveService: false,
modifyRequest: true,
autoAddMenu: true,
},
],
[
'webpackPluginFrTheme',
new WebpackPluginFrTheme(),
],
报错如下:
Error: Plugin WebpackPluginFrTheme can't be resolved

@phoema phoema added the enhancement New feature or request label Dec 30, 2019
@phoema
Copy link
Author

phoema commented Dec 30, 2019

另外,为什么引用render组件会污染全局主题呢?很不理解。

@huapeng222
Copy link

同问,在umi中如何使用WebpackPluginFrTheme

@BlueYeah
Copy link

同问,在umi中如何使用WebpackPluginFrTheme

chainWebpack(config, { webpack }) {
config.plugin('WebpackPluginFrTheme').use(WebpackPluginFrTheme)
}

  1. or try npm update

@JSupot
Copy link

JSupot commented Jan 31, 2020

另外,为什么引用render组件会污染全局主题呢?很不理解。

form-render里面对于antd的组件使用的是css样式文件,这个样式是antd的默认主题,并且在webpack打包的时候antd组件的css样式文件的优先级高于自定义主题less文件的优先级,所以会产生自定义主题失效的问题

WebpackPluginFrTheme这个插件在webpack收集依赖之前,对form-render的antd组件样式进行动态替换,通过babel分析语法,将css文件替换成less文件,这样就不会污染自定义主题了

@tw93 tw93 closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants