Skip to content

Commit

Permalink
feat: support Vite 6 (#797)
Browse files Browse the repository at this point in the history
* Support vite 6.x

* chore: fix error when building with manifest enabled

---------

Co-authored-by: userquin <[email protected]>
  • Loading branch information
gabrielrbarbosa and userquin authored Nov 29, 2024
1 parent 06c1db6 commit c4c25c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
},
"peerDependencies": {
"@vite-pwa/assets-generator": "^0.2.6",
"vite": "^3.1.0 || ^4.0.0 || ^5.0.0",
"vite": "^3.1.0 || ^4.0.0 || ^5.0.0 || ^6.0.0",
"workbox-build": "^7.3.0",
"workbox-window": "^7.3.0"
},
Expand Down
6 changes: 6 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export function _generateBundle(ctx: PWAPluginContext, bundle?: OutputBundle) {
// @ts-expect-error: for Vite 3 support, Vite 4 has removed `isAsset` property
isAsset: true,
type: 'asset',
// vite 6 deprecation: replaced with names
name: undefined,
// fix vite 6 build with manifest enabled
names: [],
source: generateWebManifestFile(options),
fileName: options.manifestFilename,
}
Expand All @@ -56,7 +59,10 @@ export function _generateBundle(ctx: PWAPluginContext, bundle?: OutputBundle) {
// @ts-expect-error: for Vite 3 support, Vite 4 has removed `isAsset` property
isAsset: true,
type: 'asset',
// vite 6 deprecation: replaced with names
name: undefined,
// fix vite 6 build with manifest enabled
names: [],
source: generateSimpleSWRegister(options, false),
fileName: FILE_SW_REGISTER,
}
Expand Down

0 comments on commit c4c25c9

Please sign in to comment.