0

I try to create vue-moment's definition file, it compiles perfectly in IntelliJ but with vue-cli build, i get:

This dependency was not found:

* vue-moment in ./src/main.ts

added to package.json:

"types": "types/index.d.ts",

main.ts

import VueMoment from 'vue-moment';
Vue.use(VueMoment);

index.d.ts:

import Vue, {PluginFunction} from 'vue';
import moment from 'moment';

export interface VueMoment {
  install: PluginFunction<never>;
}
declare const VueMoment: VueMoment;
export default VueMoment;

declare module 'vue/types/vue' {
  interface Vue {
    readonly $moment: typeof moment;
  }
}

Really this cannot be more simple. Its exactly the same code as many other libraries that works.

The package is installed and inside node_modules.

Completelly stuck there, desperatly need a hint where i did an error. Thanks in advance for help.

Rouche
  • 254
  • 2
  • 8

1 Answers1

0

Oh my, finally found the problem.

The vue-moment library had the vue-moment.js inside the root

Moving it to /src fixed it.

TypeScript compiler was somehow taking it instead of /types/vue-moment.d.ts but not IntelliJ, wich is odd its the same tsconfig...

I wont forget this one!

Rouche
  • 254
  • 2
  • 8