vue3-ace-editor: ReferenceError: window is not defined when using with Nuxt
Hoping to use this with a Vue3 app running on Nuxt 3.
But i can’t find a way to use this as it references window
as soon as it’s imported.
ReferenceError: window is not defined
at /nuxt3-app/node_modules/ace-builds/src-noconflict/ace.js:21534:21
at _require (/nuxt3-app/node_modules/ace-builds/src-noconflict/ace.js:88:37)
Do you know if there is a way that we can wrap this or include it only after the mounted
lifecycle hook?
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (10 by maintainers)
Check the code here: https://github.com/CarterLi/nuxt-ace
Okey, found a dirty solution
Also implementation of react-ace: https://github.com/securingsincity/react-ace/pull/841/files
const VAceEditor = defineAsyncComponent(() => import(‘vue3-ace-editor’).then(x => x.VAceEditor)
Should be defineAsyncComponent