Maronato / vue-toastification

Vue notifications made easy!
https://vue-toastification.maronato.dev
MIT License
3.14k stars 142 forks source link

Cannot find module 'vue-toastification' or its corresponding type declarations error raise in vue3 ts #246

Open tony95271 opened 3 years ago

tony95271 commented 3 years ago

Versions

Describe the bug

Cannot find module 'vue-toastification' or its corresponding type declarations error raise in vue3 ts.

my package.json settings

    "vue": "^3.0.0",
    "vue-class-component": "^8.0.0-0",
    "vue-toastification": "^2.0.0-rc.1",

Expected behavior

Instead of breaking the page, it should run and up.

Steps to reproduce

Reproduction Steps:

  1. Install normally, create a new project with vue3 with ts support
  2. Set up plugin, yarn add vue-toastification@next

Your Environment

Additional context

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

stale[bot] commented 3 years ago

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

marlonlewis2020 commented 1 year ago

I had a similar issue. I found two solutions to fixing it.

Solution 1. from stackoverflow.com After re-confirming I had the nuxt and vue-toastification modules installed in my node_modules folder,

  1. I created a plugis folder in my root directory (I did not already have one).
  2. I created a file called "vue-toastification.client.js"
  3. I copied the following code as the only content in that file:

    import { defineNuxtPlugin } from '#app'
    import Toast from 'vue-toastification'
    import 'vue-toastification/dist/index.css' // if needed
    
    export default defineNuxtPlugin((nuxtApp) => {
      nuxtApp.vueApp.use(Toast)
    }) 
  4. I saved it and the issue was resolved

Solution 2. from askjavascript.com After re-confirming I had the nuxt and vue-toastification modules installed in my node_modules folder,

  1. I create a decs.d.ts file in the root folder of the project
  2. I copy the following code as the only content in that file: declare module 'vue-toastification'
  3. I saved it and the issue was resolved