Skip to content

Letting vite create a manifest.json with the VitePWA plugin enabled will cause vite build to fail #798

Closed
@martylukyy

Description

@martylukyy

Hi,

during an upgrade to vite 6 i encountered an issue where vite build fails
when letting vite create a manifest.json with the manifest build option while VitePWA is in the plugins array.

error during build:
[vite:manifest] Cannot read properties of undefined (reading 'length')
    at Object.generateBundle (file:///home/projects/vitejs-vite-bj1cha/node_modules/vite/dist/node/chunks/dep-C6qYk3zB.js:13637:58)
    at Object.handler (file:///home/projects/vitejs-vite-bj1cha/node_modules/vite/dist/node/chunks/dep-C6qYk3zB.js:50896:15)
    at eval (file:///home/projects/vitejs-vite-bj1cha/node_modules/rollup/dist/es/shared/node-entry.js:20837:40)
    at https://vitejsvitebj1cha-1c10.w-credentialless-staticblitz.com/blitz.88b6dd69.js:40:23076

Here is a quick repro for the issue:
https://stackblitz.com/edit/vitejs-vite-bj1cha?file=vite.config.js

Removing VitePWA from the plugin array or not letting vite create a manifest.json will make vite build succeed.

Not sure if there is something to be done on your side or if this is an issue upstream at vite.
In case this has to be fixed upstream please leave a quick comment so i can open this issue at vitejs/vite.

This issue is reproducible with v0.21.0 and PR 786.

Kind regards
martyluky

ref #786
ref #797

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