chore: reduce bundle size for Tauri target (#1053)
* feat(tauri): improve app size * reorder modules so tauri can disable pwa * don't strip the logozio/stable
parent
23532062f5
commit
39f9e7b6ad
|
@ -1,3 +1,4 @@
|
||||||
|
import { rm } from 'fs/promises'
|
||||||
import { addImports, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
import { addImports, addPlugin, createResolver, defineNuxtModule, useNuxt } from '@nuxt/kit'
|
||||||
|
|
||||||
export default defineNuxtModule({
|
export default defineNuxtModule({
|
||||||
|
@ -14,6 +15,9 @@ export default defineNuxtModule({
|
||||||
if (nuxt.options.dev)
|
if (nuxt.options.dev)
|
||||||
nuxt.options.ssr = false
|
nuxt.options.ssr = false
|
||||||
|
|
||||||
|
nuxt.options.pwa.disable = true
|
||||||
|
nuxt.options.sourcemap.client = false
|
||||||
|
|
||||||
nuxt.options.alias = {
|
nuxt.options.alias = {
|
||||||
...nuxt.options.alias,
|
...nuxt.options.alias,
|
||||||
'unstorage/drivers/fs': 'unenv/runtime/mock/proxy',
|
'unstorage/drivers/fs': 'unenv/runtime/mock/proxy',
|
||||||
|
@ -36,5 +40,16 @@ export default defineNuxtModule({
|
||||||
|
|
||||||
addPlugin(resolve('./runtime/logging.client'))
|
addPlugin(resolve('./runtime/logging.client'))
|
||||||
addPlugin(resolve('./runtime/nitro.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')
|
||||||
|
})
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
|
@ -28,8 +28,8 @@ export default defineNuxtConfig({
|
||||||
'~/modules/purge-comments',
|
'~/modules/purge-comments',
|
||||||
'~/modules/setup-components',
|
'~/modules/setup-components',
|
||||||
'~/modules/build-env',
|
'~/modules/build-env',
|
||||||
'~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module
|
|
||||||
'~/modules/tauri/index',
|
'~/modules/tauri/index',
|
||||||
|
'~/modules/pwa/index', // change to '@vite-pwa/nuxt' once released and remove pwa module
|
||||||
],
|
],
|
||||||
experimental: {
|
experimental: {
|
||||||
payloadExtraction: false,
|
payloadExtraction: false,
|
||||||
|
|
Loading…
Reference in New Issue