diff --git a/package.json b/package.json index 3440c4e..07a27f5 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,6 @@ "@types/mapbox-gl-leaflet": "^0.0.1", "@types/uuid": "^3.4.6", "@types/workbox-window": "^4.3.3", - "babel-minify-webpack-plugin": "^0.3.1", "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^4.5.2", "imagemin-webpack-plugin": "^2.3.0", diff --git a/resources/ts/components/app.ts b/resources/ts/components/app.ts index 0a215dc..2f74e9f 100644 --- a/resources/ts/components/app.ts +++ b/resources/ts/components/app.ts @@ -90,4 +90,4 @@ export class Application extends Vue { this.intervals.departures = setInterval(() => this.updateDepartures({ stops: this.stops }), Math.max(5, settings.departures.interval) * 1000); } } -} \ No newline at end of file +} diff --git a/resources/ts/components/picker.ts b/resources/ts/components/picker.ts index f11b5a1..6ca0faa 100644 --- a/resources/ts/components/picker.ts +++ b/resources/ts/components/picker.ts @@ -2,7 +2,7 @@ import Component from "vue-class-component"; import Vue from "vue"; import { Stop, StopGroup, StopGroups } from "../model"; import { Prop, Watch } from "vue-property-decorator"; -import { ensureArray, FetchingState, filter, map } from "../utils"; +import { ensureArray, FetchingState, filter, map, time } from "../utils"; import { debounce } from "../decorators"; import urls from '../urls'; @@ -39,7 +39,7 @@ export class FinderComponent extends Vue { const groups = map( this.found, (group: StopGroup, name: string) => - group.filter(stop => !this.blacklist.some(blacklisted => blacklisted.id == stop.id)) + group.filter(stop => !this.blacklist.some(blacklisted => blacklisted.id === stop.id)) ) as StopGroups; return filter(groups, group => group.length > 0); diff --git a/resources/ts/utils.ts b/resources/ts/utils.ts index 293f245..2601a47 100644 --- a/resources/ts/utils.ts +++ b/resources/ts/utils.ts @@ -67,3 +67,11 @@ export function get(object: any, path: string): any { export function distinct(value: T, index: number, array: T[]) { return array.indexOf(value) === index; } + +export function time(action: () => T, name?: string) { + const start = performance.now(); + const result = action(); + console.debug(`${name || 'this'} operation took ${performance.now() - start}ms`); + + return result; +} diff --git a/webpack.config.js b/webpack.config.js index 2227237..439c13d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -20,7 +20,8 @@ const config = { resolve: { extensions: ['.tsx', '.ts', '.js'], alias: { - 'vue$': 'vue/dist/vue.esm.js' + 'vue$': 'vue/dist/vue.esm.js', + 'mapbox-gl$': 'mapbox-gl/dist/mapbox-gl-unminified' } }, module: { @@ -71,12 +72,7 @@ const config = { }], swDest: '../service-worker.js' }) - ], - optimization: { - minimizer: [ - new BabelMinifyPlugin() - ] - } + ] }; module.exports = (env, argv) => {