我使用webPack5编写了一个简单的TypeScript项目 我的需求很简单就是在WPF中的浏览器调用JS里面的一部分代码
但我使用生产模式编译后就不能访问到我定义的方法或变量了。。所以我应该怎么做?
import * as monaco from 'monaco-editor';
import './index.css';
const axios = require('axios') ;
let editor= monaco.editor.create(document.body, {
value: ['function x() {', '\tconsole.log("Hello world!");', '}'].join('\n'),
language: 'typescript',
theme:'vs-dark'
});
//这是我要在.NET浏览器使用调用的方法 但使用生产模式编译后我无法访问到这个方法名了。。。
let GetText = function():string {
return editor.getValue();
}
console.log(GetText());
运行结果及报错内容
需求
所以我如何才能在浏览器控制台调用 GetText() 方法