Question Part
I want to use monaco-editor in Electron(ver. 13), and I used static file.
To require the monaco-editor, I puted
<script src="../plugins/plugin-monaco/loader.js"></script>
part in the head of the page.
But I still use nodeIntergration to let the renderer process know the type of the system to adjust the control buttons. So I required 'os' by
require('os')
, and from then on the contral pad says that:
vue.min.js:6 Error: Check dependency list! Synchronous require cannot resolve module 'os'. This is the first mention of this module!
at r.synchronousRequire (loader.js:8)
at n (loader.js:9)
at wn.data (index.html:90)
at wn.<anonymous> (vue.min.js:6)
at vue.min.js:6
at vue.min.js:6
at vn (vue.min.js:6)
at wn.t._init (vue.min.js:6)
at new wn (vue.min.js:6)
at fn_createVue (index.html:86)
OK. It is insteresting, isn't it? I enbled the function nodeIntergration, but it says cannot find the moudle 'os'!
When I try to put
delete require
It says that:
vue.min.js:6 ReferenceError: require is not defined
at wn.data (index.html:90)
at wn.<anonymous> (vue.min.js:6)
at vue.min.js:6
at vue.min.js:6
at vn (vue.min.js:6)
at wn.t._init (vue.min.js:6)
at new wn (vue.min.js:6)
at fn_createVue (index.html:86)
at index.html:306
Ue @ vue.min.js:6
vue.min.js:6 ReferenceError: platform is not defined
at wn.eval (eval at Ya (vue.min.js:6), <anonymous>:3:283)
at wn.e._render (vue.min.js:6)
at wn.r (vue.min.js:6)
at fn.get (vue.min.js:6)
at new fn (vue.min.js:6)
at vue.min.js:6
at wn.$mount (vue.min.js:6)
at wn.$mount (vue.min.js:6)
at wn.t._init (vue.min.js:6)
at new wn (vue.min.js:6)
When I deleted the load of loader.js file, it says:
index.html:305 Uncaught TypeError: require.config is not a function
at index.html:305
So HOW CAN I SOLVE THE PROBLEM?(Waiting online, very anxious)
Additional Part:
The way to require monaco-editor:
<script src="../plugins/plugin-monaco/loader.js"></script>
require.config({ paths: { 'vs': '../plugins/plugin-monaco' }})
require(['vs/editor/editor.main'], fn_createVue())
and the function fn_createVue() create a viewModel of Vue.js, including
require('os')
Versions Part
| moudle | version |
|---|---|
| Electron | 13.1.6 |
| monaco-editor | 0.25.2 |