antoniandre / vue-cal

A Vue.js full calendar, no dependency, no BS. :metal:
https://antoniandre.github.io/vue-cal/
MIT License
1.23k stars 234 forks source link

Failed to resolve module specifier "vue-cal" #506

Closed szekelygobe closed 1 year ago

szekelygobe commented 1 year ago

After install npm i vue-cal and in my js file: import VueCal from 'vue-cal' import 'vue-cal/dist/vuecal.css' failed to import with this error message: Failed to resolve module specifier "vue-cal"

snurbol commented 1 year ago

If you are using Vue-cal in Vue + Typescript project, then you can't using module. Because author not add type defenitions to source code (*.d.ts files). You have 2 methods:

  1. Easy method: Add 2 lines to tsconfig.json file in your project folder. This switch off type checking in imported JS modules. { "compilerOptions": { ... "noImplicitAny": false, "allowJs": true, ... } }
  2. Advanced method. Write .d.ts file yourself to complete type checking. Info https://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html

Today I also met with the same problem. Solved using first method. I hope the author will add the necessary files to the project to support Typescript. I'm busy at the moment, but as soon as I'm free I can help the author with Typescript

Cubxx commented 3 months ago

@snurbol #168 there is .d.ts file for vue2, it might help you