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:
Thomas Citharel
2020-10-13 20:39:59 +02:00
parent f627cab292
commit 93cecbe49c
66 changed files with 167 additions and 283 deletions

View File

@@ -1,7 +1,6 @@
import { Component, Vue, Ref } from "vue-property-decorator";
import { ActorType, IActor } from "@/types/actor";
import { IFollower } from "@/types/actor/follower.model";
import TimeAgo from "javascript-time-ago";
@Component
export default class RelayMixin extends Vue {
@@ -13,20 +12,11 @@ export default class RelayMixin extends Vue {
perPage = 10;
timeAgoInstance: TimeAgo | null = null;
async mounted() {
const localeName = this.$i18n.locale;
const locale = await import(`javascript-time-ago/locale/${localeName}`);
TimeAgo.addLocale(locale);
this.timeAgoInstance = new TimeAgo(localeName);
}
toggle(row: object) {
toggle(row: Record<string, unknown>): void {
this.table.toggleDetails(row);
}
async onPageChange(page: number) {
async onPageChange(page: number): Promise<void> {
this.page = page;
await this.$apollo.queries.relayFollowings.fetchMore({
variables: {
@@ -53,11 +43,4 @@ export default class RelayMixin extends Vue {
(actor.preferredUsername === "relay" || actor.preferredUsername === actor.domain)
);
}
timeago(dateTime: string): string {
if (this.timeAgoInstance != null) {
return this.timeAgoInstance.format(new Date(dateTime));
}
return "";
}
}