materiahq / ngx-monaco-editor

Monaco Editor Library for Angular v6 and above
MIT License
159 stars 35 forks source link

Error loading monaco-editor #67

Closed seravifer closed 3 years ago

seravifer commented 3 years ago

I install this package on the https://github.com/maximegris/angular-electron template and throw this:

materia-ui-ngx-monaco-editor.js:54 Error loading monaco-editor:  Error: Invalid package /Users/savila/work/angular-electron/node_modules/electron/dist/Electron.app/Contents/Resources/electron.asar
    at createError (electron/js2c/asar_bundle.js:5)
    at fsReadFileAsar (electron/js2c/asar_bundle.js:5)
    at Object.e.readFile (electron/js2c/asar_bundle.js:5)
    at r._readSourceAndCachedData (loader.js:958)
    at r.load (loader.js:838)
    at r.load (loader.js:614)
    at l (loader.js:1635)
    at r._loadModule (loader.js:1647)
    at r._resolve (loader.js:1732)
    at r.defineModule (loader.js:1379)
seravifer commented 3 years ago

It's seems if you set contextIsolation: false, doesn't work.

nikhilnxvverma1 commented 3 years ago

I have the exact same issue on the exact same repo you mentioned. I am not sure what your solution is? Why was this closed. Can you please elaborate on your solution. Thanks.

seravifer commented 3 years ago

Yes. By default, they have contextIsolation disabled and for some reason it fails to load the library. If you set that property to true, it works. I don't know exactly why. https://www.electronjs.org/docs/tutorial/context-isolation

xsip commented 1 year ago

is there any solution on this? I need contextIsolation set to false for loading native node modules in my angular app.