-
-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I'm using AstroPWA and I want to generate assets each build.
Unfortunately, the assets generated put in /dist/ aren't copied in ./vercel/output/static
I ended up just generate them once and put them on /public.
But using pwaAssets looks useless then.
package.json
@astrojs/vercel": "^9.0.1"@vite-pwa/assets-generator": "^1.0.2- `@vite-pwa/astro": "^1.2.0
astro.config.js
import { defineConfig } from 'astro/config';
import preact from '@astrojs/preact';
import vercel from '@astrojs/vercel';
import sitemap from '@astrojs/sitemap';
import robotsTxt from 'astro-robots-txt';
import tailwindcss from '@tailwindcss/vite';
import compress from 'astro-compress';
import { loadEnv } from 'vite';
import AstroPWA from '@vite-pwa/astro';
const { APP_BASE, APP_SITE, PUBLIC_APP_NAME, PUBLIC_APP_DESCRIPTION } = loadEnv(process.env.NODE_ENV, process.cwd(), '');
const THEME_COLOR = "#f9f5de";
const BACKGROUND_COLOR = "#f9f5de";
const config = {
site: `${APP_SITE}${APP_BASE}`,
base: APP_BASE,
vite: {
logLevel: 'info',
plugins: [tailwindcss()],
},
output: 'static',
adapter: vercel(),
integrations: [
preact(),
sitemap(),
robotsTxt(),
AstroPWA({
base: APP_BASE,
scope: '/',
registerType: 'autoUpdate',
pwaAssets: {
config: true,
},
workbox: {
globPatterns: ['**/*.{css,js,html,svg,png,ico,txt}'],
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024, // 5MB
},
manifest: {
name: PUBLIC_APP_NAME,
short_name: PUBLIC_APP_NAME,
description: PUBLIC_APP_DESCRIPTION,
theme_color: THEME_COLOR,
background_color: BACKGROUND_COLOR,
display: 'standalone',
orientation: 'any',
start_url: '/',
scope: '/',
icons: [
{
src: 'pwa-64x64.png',
sizes: '64x64',
type: 'image/png'
},
{
src: 'pwa-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: 'pwa-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'any'
},
{
src: 'maskable-icon-512x512.png',
sizes: '512x512',
type: 'image/png',
purpose: 'maskable'
}
],
categories: []
},
}),
compress()
]
};
export default defineConfig(config);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels