fix: use nitro overlay to skip dev assets in production
|
@ -1 +1,3 @@
|
||||||
*.css
|
*.css
|
||||||
|
*.png
|
||||||
|
*.ico
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { APP_NAME, STORAGE_KEY_LANG } from '~/constants'
|
||||||
export function setupPageHeader() {
|
export function setupPageHeader() {
|
||||||
const isDev = process.dev
|
const isDev = process.dev
|
||||||
const isPreview = useRuntimeConfig().public.env === 'staging'
|
const isPreview = useRuntimeConfig().public.env === 'staging'
|
||||||
const suffix = isDev || isPreview ? '-dev' : ''
|
|
||||||
|
|
||||||
const i18n = useI18n()
|
const i18n = useI18n()
|
||||||
|
|
||||||
|
@ -12,15 +11,6 @@ export function setupPageHeader() {
|
||||||
lang: () => i18n.locale.value,
|
lang: () => i18n.locale.value,
|
||||||
},
|
},
|
||||||
titleTemplate: title => `${title ? `${title} | ` : ''}${APP_NAME}${isDev ? ' (dev)' : isPreview ? ' (preview)' : ''}`,
|
titleTemplate: title => `${title ? `${title} | ` : ''}${APP_NAME}${isDev ? ' (dev)' : isPreview ? ' (preview)' : ''}`,
|
||||||
bodyAttrs: {
|
|
||||||
class: 'overflow-x-hidden',
|
|
||||||
},
|
|
||||||
link: [
|
|
||||||
{ rel: 'icon', type: 'image/svg+xml', href: `/favicon${suffix}.svg` },
|
|
||||||
{ rel: 'alternate icon', type: 'image/x-icon', href: `/favicon${suffix}.ico` },
|
|
||||||
{ rel: 'icon', type: 'image/png', href: `/favicon-16x16${suffix}.png`, sizes: '16x16' },
|
|
||||||
{ rel: 'icon', type: 'image/png', href: `/favicon-32x32${suffix}.png`, sizes: '32x32' },
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// eslint-disable-next-line no-unused-expressions
|
// eslint-disable-next-line no-unused-expressions
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
|
import { fileURLToPath } from 'node:url'
|
||||||
import Inspect from 'vite-plugin-inspect'
|
import Inspect from 'vite-plugin-inspect'
|
||||||
import { isCI, isDevelopment } from 'std-env'
|
import { isCI, isDevelopment } from 'std-env'
|
||||||
import { i18n } from './config/i18n'
|
import { i18n } from './config/i18n'
|
||||||
|
|
||||||
|
const isPreview = process.env.PULL_REQUEST === 'true'
|
||||||
|
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
ssr: false,
|
ssr: false,
|
||||||
modules: [
|
modules: [
|
||||||
|
@ -48,9 +51,9 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
runtimeConfig: {
|
runtimeConfig: {
|
||||||
deployUrl: !isCI
|
deployUrl: isDevelopment
|
||||||
? 'http://localhost:5314'
|
? 'http://localhost:5314'
|
||||||
: process.env.PULL_REQUEST === 'true'
|
: isPreview
|
||||||
? process.env.DEPLOY_PRIME_URL
|
? process.env.DEPLOY_PRIME_URL
|
||||||
: 'https://elk.zone',
|
: 'https://elk.zone',
|
||||||
cloudflare: {
|
cloudflare: {
|
||||||
|
@ -59,7 +62,7 @@ export default defineNuxtConfig({
|
||||||
apiToken: '',
|
apiToken: '',
|
||||||
},
|
},
|
||||||
public: {
|
public: {
|
||||||
env: isCI ? process.env.PULL_REQUEST === 'true' ? 'staging' : 'production' : 'local',
|
env: isCI ? isPreview ? 'staging' : 'production' : 'local',
|
||||||
translateApi: '',
|
translateApi: '',
|
||||||
// Masto uses Mastodon version checks to see what features are enabled.
|
// Masto uses Mastodon version checks to see what features are enabled.
|
||||||
// Mastodon alternatives like GoToSocial will always fail these checks, so
|
// Mastodon alternatives like GoToSocial will always fail these checks, so
|
||||||
|
@ -72,6 +75,9 @@ export default defineNuxtConfig({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
nitro: {
|
nitro: {
|
||||||
|
publicAssets: [
|
||||||
|
...(isDevelopment || isPreview ? [{ dir: fileURLToPath(new URL('./public-dev', import.meta.url)) }] : []),
|
||||||
|
],
|
||||||
prerender: {
|
prerender: {
|
||||||
crawlLinks: false,
|
crawlLinks: false,
|
||||||
routes: ['/', '/200.html'],
|
routes: ['/', '/200.html'],
|
||||||
|
@ -82,6 +88,15 @@ export default defineNuxtConfig({
|
||||||
head: {
|
head: {
|
||||||
// Prevent arbitrary zooming on mobile devices
|
// Prevent arbitrary zooming on mobile devices
|
||||||
viewport: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
|
viewport: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no',
|
||||||
|
bodyAttrs: {
|
||||||
|
class: 'overflow-x-hidden',
|
||||||
|
},
|
||||||
|
link: [
|
||||||
|
{ rel: 'icon', type: 'image/png', href: '/favicon.png' },
|
||||||
|
{ rel: 'alternate icon', type: 'image/x-icon', href: '/favicon.ico' },
|
||||||
|
{ rel: 'icon', type: 'image/png', href: '/favicon-16x16.png', sizes: '16x16' },
|
||||||
|
{ rel: 'icon', type: 'image/png', href: '/favicon-32x32.png', sizes: '32x32' },
|
||||||
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
i18n,
|
i18n,
|
||||||
|
|
Before Width: | Height: | Size: 918 B After Width: | Height: | Size: 918 B |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |