Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
martylukyy opened this issue Nov 26, 2024 · 3 comments · May be fixed by #786
Open

Comments

@martylukyy
Copy link

martylukyy commented Nov 26, 2024

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

@userquin
Copy link
Member

userquin commented Nov 29, 2024

Should be fixed using this version: https://pkg.pr.new/vite-plugin-pwa@8bcc1b7 (check last commit in the PR)

I'm going to release a new version with Vite 6 support, sorry for the delay.

@userquin
Copy link
Member

closed via #797

@userquin
Copy link
Member

userquin commented Nov 29, 2024

sorry, this issue is using the environment api PR:

I'm going to release a new patch (v0.21.1) adding vite 6 to the peers + fix build when manifest enabled via #797 PR : we're going to keep #786 (using Vite 6 Environment API) open for a while, we want to do some more tests.

@userquin userquin linked a pull request Nov 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants