Skip to content

Unexpected behaviour when using cloudflare deploy adapter #66

@kumardeo

Description

@kumardeo

When I use @astrojs/cloudflare as deploy adapter in adapter field of astro config, all the files generated by vite-pwa are available in dist/_worker.js directory instead of dist.

"astro": "^5.7.9"
"@astrojs/cloudflare": "^12.5.1"
"@vite-pwa/astro": "^1.0.1"
"vite-plugin-pwa": "^1.0.0"

astro.config.ts:

import cloudflare from '@astrojs/cloudflare';
import AstroPWA from '@vite-pwa/astro';
import { defineConfig } from 'astro/config';

// https://astro.build/config
export default defineConfig({
  adapter: cloudflare(),
  trailingSlash: 'never',
  integrations: [
    AstroPWA({
      registerType: 'autoUpdate',
      manifest: {
        name: "App",
        short_name: "App",
        icons: []
      },
      workbox: {
        globDirectory: 'dist',
        globPatterns: ['**/*.{js,css,svg,png,jpg,jpeg,gif,webp,woff,woff2,ttf,eot,ico}'],
        globIgnores: ['**/_worker.js/**/*'],
        // Don't fallback on document based (e.g. `/some-page`) requests
        // This removes an errant console.log message from showing up.
        navigateFallback: null,
      },
      experimental: {
        directoryAndTrailingSlashHandler: true,
      },
    }),
  ],
});

When removing @astrojs/cloudflare adapter, the files are generated in dist

Metadata

Metadata

Assignees

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