nextTick(() => {
// init
const node = document.getElementById('monacoElement');
if (node) {
monacoEditor.value = monaco.editor.createDiffEditor(node, {
theme: 'vs',
roundedSelection: false,
autoIndent: true,
readOnly: false,
language: 'json',
})
const oldValModel = monaco.editor.createModel(props.oldVal, "json")
const newValModel = monaco.editor.createModel(props.newVal, "json")
monacoEditor.value.setModel({
original: oldValModel,
modified: newValModel
})
}
})
当我使用 monaco.editor.create() 时,它运行正常,但是当我使用 monaco.editor.createDiffEditor() 时,运行失败
我尝试添加 vite-plugin-monaco-editor 但它不起作用。同样的错误被拒绝。另一个,我尝试在 window 上添加一个名为 getWorker 的属性,结果相同
hotReload.js:7 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'VSCODE_DEV')
at isHotReloadEnabled (hotReload.js:7:14)
at observeHotReloadableExports (utils.js:206:9)
at readHotReloadableExport (utils.js:202:5)
at diffEditorWidget.js:141:95
at AutorunObserver._runFn (autorun.js:24:9)
at AutorunObserver._runIfNeeded (autorun.js:86:22)
at new AutorunObserver (autorun.js:61:14)
at autorunOpts (autorun.js:10:12)
at autorunWithStore (autorun.js:20:24)
at new DiffEditorWidget2 (diffEditorWidget.js:139:24)