vue-sweetalert2
vue-sweetalert2 copied to clipboard
When installing package its output : ERROR Cannot restart nuxt: Cannot read properties of undefined (reading 'sweetalert')
ERROR Cannot restart nuxt: Cannot read properties of undefined (reading 'sweetalert')
at nuxtVueSweetalert2 (node_modules/vue-sweetalert2/nuxt/index.js:5:50) at installModule (node_modules/@nuxt/kit/dist/index.mjs:2426:101) at async initNuxt (node_modules/nuxt/dist/index.mjs:3533:7) at async _load (node_modules/nuxi/dist/chunks/dev-internal.mjs:199:7) at async load (node_modules/nuxi/dist/chunks/dev-internal.mjs:246:9) at async _applyPromised (node_modules/nuxi/dist/chunks/dev-internal.mjs:102:10)
Hi. Can you tell me what dependencies you are using? What version of Nuxt?
I'm facing the same issue in nuxt3
你好。 你能告诉我你正在使用什么依赖项吗? Nuxt 是什么版本?
ERROR Cannot restart nuxt: Cannot read properties of undefined (reading 'sweetalert')
at nuxtVueSweetalert2 (node_modules.pnpm\[email protected][email protected]\node_modules\vue-sweetalert2\nuxt\index.js:5:50)
at installModule (/C:/Users/xxx/Desktop/xxx/node_modules/.pnpm/@[email protected][email protected]/node_modules/@nuxt/kit/dist/index.mjs:2415:101)
at async initNuxt (/C:/Users/xxx/Desktop/xxx/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/nuxt/dist/index.mjs:3858:7)
at async NuxtDevServer._load (/C:/Users/xxx/Desktop/xxx/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/dev2.mjs:253:5)
at async NuxtDevServer.load (/C:/Users/xxx/Desktop/xxx/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/dev2.mjs:185:7)
at async _applyPromised (/C:/Users/xxx/Desktop/xxx/node_modules/.pnpm/[email protected]/node_modules/nuxi/dist/chunks/dev2.mjs:105:10)
我在 nuxt3 中遇到同样的问题
Have you solved this problem?
I had the same problem with nuxt3, what i did was create a 'plugins' folder and created the file 'vue-sweetalert2.js'
` import { defineNuxtPlugin } from '#app'; import VueSweetalert2 from 'vue-sweetalert2'; import 'sweetalert2/dist/sweetalert2.min.css';
export default defineNuxtPlugin(nuxtApp => { nuxtApp.vueApp.use(VueSweetalert2); }); `
and in my nuxt config added the section:
plugins: [{ src: './plugins/vue-sweetalert2.js', mode: 'client' }],
now I can import and use in my pages as needed. Not sure if it's the right way.
@sezohessen @youkei-zzz @milank-developer @ClouD-cZ Hi. SweatAlert2 - has a critical vulnerability, so I have plans to stop supporting it. But to solve your problem, you can import sweatalert2 without using vue-sweataler2 library.
import { type SweetAlertOptions } from 'sweetalert2';
import Swal from 'sweetalert2/dist/sweetalert2.js';
@sezohessen @youkei-zzz @milank-developer @ClouD-cZ 你好。 SweatAlert2 - 有一个严重漏洞,因此我计划停止支持它。 但要解决您的问题,您可以导入 Sweatalert2 而不使用 vue-sweataler2 库。
import { type SweetAlertOptions } from 'sweetalert2'; import Swal from 'sweetalert2/dist/sweetalert2.js';
ok thank you
@sezohessen @youkei-zzz @milank-developer @ClouD-cZ Hi. SweatAlert2 - has a critical vulnerability, so I have plans to stop supporting it. But to solve your problem, you can import sweatalert2 without using vue-sweataler2 library.
import { type SweetAlertOptions } from 'sweetalert2'; import Swal from 'sweetalert2/dist/sweetalert2.js';
@avil13 Hello. Would you mind to share some details about the vulnerability? Would you advise against using it? Thank you.
@ClouD-cZ There's already been a discussion here https://github.com/avil13/vue-sweetalert2/issues/149
fixed in #156