Improve build times
* Fix bulma/buefy being imported many (many !!!) times * Remove javascript-time-ago because date-fns pretty much does the same thing * Make sure languages are loaded asynchronously Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import Vue from "vue";
|
||||
import Locale from "date-fns";
|
||||
import VueInstance from "vue";
|
||||
|
||||
declare module "vue/types/vue" {
|
||||
interface Vue {
|
||||
@@ -7,8 +7,8 @@ declare module "vue/types/vue" {
|
||||
}
|
||||
}
|
||||
|
||||
export function DateFnsPlugin(vue: typeof Vue, { locale }: { locale: string }): void {
|
||||
export function DateFnsPlugin(vue: typeof VueInstance, { locale }: { locale: string }): void {
|
||||
import(`date-fns/locale/${locale}/index.js`).then((localeEntity) => {
|
||||
Vue.prototype.$dateFnsLocale = localeEntity;
|
||||
VueInstance.prototype.$dateFnsLocale = localeEntity;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import Vue from "vue";
|
||||
/* eslint-disable no-shadow */
|
||||
import VueInstance from "vue";
|
||||
import { ColorModifiers } from "buefy/types/helpers.d";
|
||||
import { Route, RawLocation } from "vue-router";
|
||||
|
||||
@@ -12,39 +13,39 @@ declare module "vue/types/vue" {
|
||||
beforeRouteEnter?(
|
||||
to: Route,
|
||||
from: Route,
|
||||
next: (to?: RawLocation | false | ((vm: Vue) => void)) => void
|
||||
next: (to?: RawLocation | false | ((vm: VueInstance) => void)) => void
|
||||
): void;
|
||||
|
||||
beforeRouteLeave?(
|
||||
to: Route,
|
||||
from: Route,
|
||||
next: (to?: RawLocation | false | ((vm: Vue) => void)) => void
|
||||
next: (to?: RawLocation | false | ((vm: VueInstance) => void)) => void
|
||||
): void;
|
||||
|
||||
beforeRouteUpdate?(
|
||||
to: Route,
|
||||
from: Route,
|
||||
next: (to?: RawLocation | false | ((vm: Vue) => void)) => void
|
||||
next: (to?: RawLocation | false | ((vm: VueInstance) => void)) => void
|
||||
): void;
|
||||
}
|
||||
}
|
||||
|
||||
export class Notifier {
|
||||
private readonly vue: typeof Vue;
|
||||
private readonly vue: typeof VueInstance;
|
||||
|
||||
constructor(vue: typeof Vue) {
|
||||
constructor(vue: typeof VueInstance) {
|
||||
this.vue = vue;
|
||||
}
|
||||
|
||||
success(message: string) {
|
||||
success(message: string): void {
|
||||
this.notification(message, "is-success");
|
||||
}
|
||||
|
||||
error(message: string) {
|
||||
error(message: string): void {
|
||||
this.notification(message, "is-danger");
|
||||
}
|
||||
|
||||
info(message: string) {
|
||||
info(message: string): void {
|
||||
this.notification(message, "is-info");
|
||||
}
|
||||
|
||||
@@ -60,6 +61,6 @@ export class Notifier {
|
||||
}
|
||||
|
||||
/* eslint-disable */
|
||||
export function NotifierPlugin(vue: typeof Vue): void {
|
||||
export function NotifierPlugin(vue: typeof VueInstance): void {
|
||||
vue.prototype.$notifier = new Notifier(vue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user