Open xiaohuoni opened 5 years ago
问题一:options并没有透传数据,配置可以通过api.config取到 https://github.com/sorrycc/sekiro/blob/bbfc1dd87f8ba0550f69c4561506ab9a6f63abd5/plugin.js#L2
export default { antd: true, };
问题二:配置antd提示错误
watch handler failed, since ".umirc.js" 中配置的 "antd" 并非约定的配置项,请选择 "chainWebpack, context, disableRedirectHoist, exportStatic, outputPath, plugins, routes, runtimePublicPath, singular, treeShaking, base, mountElementId, mock, history, alias, autoprefixer, babel, browserslist, chainConfig, copy, cssLoaderOptions, cssModulesExcludes, cssModulesWithAffix, cssnano, cssPublicPath, define, devServer, devtool, disableCSSModules, disableCSSSourceMap, disableDynamicImport, env, es5ImcompatibleVersions, externals, extraBabelIncludes, extraBabelPlugins, extraBabelPresets, extraPostCSSPlugins, hash, ignoreMomentLocale, lessLoaderOptions, manifest, minimizer, proxy, publicPath, sass, terserJSOptions, theme, tsConfigFile, typescript, uglifyJSOptions, urlLoaderExcludes, mountElementId, targets, dva" 中的一项
解决方法:通过_registerConfig配置,但文档里面不推荐
api._registerConfig(() => { return () => { return { name: 'antd', validate: () => true, onChange(newConfig) { api.service.restart(`antd changed`); }, }; }; });
demo:https://github.com/xiaohuoni/sekiro
_registerConfig
options 获取不到.umirc.js的配置,antd:true 这里只是演示,没有实际意义。 .umirc.js 配置完,只能从api.config里面取到值
@sorrycc cc
问题一:options并没有透传数据,配置可以通过api.config取到 https://github.com/sorrycc/sekiro/blob/bbfc1dd87f8ba0550f69c4561506ab9a6f63abd5/plugin.js#L2
问题二:配置antd提示错误
解决方法:通过_registerConfig配置,但文档里面不推荐
demo:https://github.com/xiaohuoni/sekiro