Skip to content

Assets generated in /dist/ aren't copied in ./vercel/output/static at build time #71

@Jeremboo

Description

@Jeremboo

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);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions