imguolao / monaco-vue

Use monaco-editor loaded from CDN in Vue 2&3, no need to bundling.
https://imguolao.github.io/monaco-vue/
MIT License
211 stars 21 forks source link

bug: the monaco editor is loaded during SSR #30

Closed JeanJPNM closed 1 year ago

JeanJPNM commented 1 year ago

I'm currently using this editor in a vitepress project, where I have a custom component that uses the Editor internally. In the vitepress docs, it is indicated to wrap components that depend on browser APIs with <Clientonly>, however, this does not work well in this scenario because I need to render the contents of my vue component with the loading placeholder during ssr.

One way to solve this issue would be to update the useMonaco function to call loader.init within the onMounted callback.