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.define 与 typescript declare 合用时,报错:_ is not defined
.umirc.ts :
import { defineConfig } from 'umi'; export default defineConfig({ define: { foo:1 }, mako:{} });
pages/index.tsx
declare var foo: string; export default function HomePage() { return ( <div> {foo} </div> ); }
页面显示 1
#1549
The text was updated successfully, but these errors were encountered:
问题可能与 env_replacer.rs/EnvReplacer.visit_mut_expr 中的这段代码有关:
// 先判断 env 中的变量名称,是否是上下文中已经存在的变量名称 if ctxt.outer() != self.unresolved_mark { expr.visit_mut_children_with(self); return; }
因为 "declare var foo: string;" 导致上下文已经存在 foo ,所以未能注入全局变量
Sorry, something went wrong.
@Lemonnnnnnnnnnn thanks a lot
stormslowly
Successfully merging a pull request may close this issue.
版本
问题
umi.define 与 typescript declare 合用时,报错:_ is not defined
最简复现
.umirc.ts :
pages/index.tsx
期望
页面显示 1
相关 issue
#1549
The text was updated successfully, but these errors were encountered: