We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在 umi 的 config 的里设置了 define 之后,全局ts里增加声明,并在组件里使用
import { Layout, Row, Typography } from 'antd'; import React from 'react'; import styles from './Guide.less'; interface Props { _id?: string; name: string; } export const idMap: Record<string, string> = { dev: '4431j2', pre: '0asd4', prod: 'zxcxczxczxc', }; // 脚手架示例组件 const Guide: React.FC<Props> = (props) => { const { _id = idMap[MY_ENV], name } = props; return ( <Layout> <Row> <Typography.Title level={3} className={styles.title}> <span>{MY_ENV}</span> <span>{_id}</span> 欢迎使用 <strong>{name}</strong> ! </Typography.Title> </Row> </Layout> ); }; export default Guide;
会产生如下异常:
关闭 mako,使用 msfu,显示正常 选择使用 umi@4.3.11 附带的 mako@0.7.9,显示也正常
该问题在我使用 mako@0.8.6时可复现:https://codesandbox.io/p/github/ShotHeadman/umi-mako-env/master?import=true
The text was updated successfully, but these errors were encountered:
const { _id = idMap[MY_ENV], name } = props;
先修改成
const defaultEnv = MY_ENV; const { _id = idMap[defaultEnv], name } = props
先绕过下
Sorry, something went wrong.
xusd320
Successfully merging a pull request may close this issue.
在 umi 的 config 的里设置了 define 之后,全局ts里增加声明,并在组件里使用
会产生如下异常:

关闭 mako,使用 msfu,显示正常
选择使用 umi@4.3.11 附带的 mako@0.7.9,显示也正常
该问题在我使用 mako@0.8.6时可复现:https://codesandbox.io/p/github/ShotHeadman/umi-mako-env/master?import=true
The text was updated successfully, but these errors were encountered: