From 39f9e7b6ad336fd8848e03a539e57f7b0a48fbaa Mon Sep 17 00:00:00 2001 From: Jonas Kruckenberg Date: Fri, 13 Jan 2023 09:46:07 +0100 Subject: [PATCH 1/9] chore: reduce bundle size for Tauri target (#1053) * feat(tauri): improve app size * reorder modules so tauri can disable pwa * don't strip the logo --- modules/tauri/index.ts | 15 +++++++++++++++ nuxt.config.ts | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/tauri/index.ts b/modules/tauri/index.ts index a0f52fec..eb00a5b8 100644 --- a/modules/tauri/index.ts +++ b/modules/tauri/index.ts @@ -1,3 +1,4 @@ +import { rm } from 'fs/promises' import { addImports, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit' export default defineNuxtModule({ @@ -14,6 +15,9 @@ export default defineNuxtModule({ if (nuxt.options.dev) nuxt.options.ssr = false + nuxt.options.pwa.disable = true + nuxt.options.sourcemap.client = false + nuxt.options.alias = { ...nuxt.options.alias, 'unstorage/drivers/fs': 'unenv/runtime/mock/proxy', @@ -36,5 +40,16 @@ export default defineNuxtModule({ addPlugin(resolve('./runtime/logging.client')) addPlugin(resolve('./runtime/nitro.client')) + + // cleanup files copied from the public folder that we don't need + nuxt.hook('close', async () => { + await rm('.output/public/_redirects') + await rm('.output/public/apple-touch-icon.png') + await rm('.output/public/elk-og.png') + await rm('.output/public/favicon.ico') + await rm('.output/public/pwa-192x192.png') + await rm('.output/public/pwa-512x512.png') + await rm('.output/public/robots.txt') + }) }, }) diff --git a/nuxt.config.ts b/nuxt.config.ts index 525ea5dd..1664bf5e 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -28,8 +28,8 @@ export default defineNuxtConfig({ '~/modules/purge-comments', '~/modules/setup-components', '~/modules/build-env', - '~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module '~/modules/tauri/index', + '~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module ], experimental: { payloadExtraction: false, From f78a7cd98d860218c38b84a3ef4f32baeb9f978b Mon Sep 17 00:00:00 2001 From: patak Date: Fri, 13 Jan 2023 10:03:05 +0100 Subject: [PATCH 2/9] feat: link to github releases from version number in app --- components/nav/NavFooter.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/nav/NavFooter.vue b/components/nav/NavFooter.vue index ed8fb042..223a71aa 100644 --- a/components/nav/NavFooter.vue +++ b/components/nav/NavFooter.vue @@ -47,8 +47,15 @@ function toggleDark() { {{ $t('nav.built_at', [$d(buildTimeDate, 'shortDate')]) }} · - - v{{ buildInfo.version }} + + v{{ buildInfo.version }} + {{ buildInfo.env }}