eval中使用import引入的函数,会报 Demo2 is not defined
Demo2 is not defiend
import { Demo2 } from "./Demo";
function App() {
//Demo2是个函数 ()=>{console.log('result')}
const Demo3 = Demo2;
eval("Demo3()"); //result
eval("Demo2()"); //Demo2 is not defined
return (
<></>
);
}
export default App;