Skip to content

Commit 707b371

Browse files
committed
Make sure the manifest is generated on build
1 parent 7c85fb8 commit 707b371

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
dev-dist
2020
dist
2121
node_modules
22+
public/manifest.webmanifest
2223
test/cypress/downloads
2324
test/cypress/screenshots
2425
test/cypress/videos

manifest.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { writeFileSync } from 'node:fs'
2+
import { resolve } from 'node:path'
3+
import { config } from './pwa.config'
4+
5+
const manifest = JSON.stringify(config.manifest, null, 2)
6+
7+
// The manifest is not being created on nuxt generate.
8+
// https://github.com/vite-pwa/nuxt/issues/17
9+
writeFileSync(resolve('./public/manifest.webmanifest'), manifest)

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"private": true,
66
"type": "module",
77
"scripts": {
8-
"build": "nuxt prepare && nuxt typecheck && nuxt generate",
8+
"build": "nuxt prepare && nuxt typecheck && tsx manifest.ts && nuxt generate",
99
"clean": "rimraf .output dev-dist dist",
1010
"dev": "nuxt dev --port 8888",
1111
"preview": "serve -s ./.output/public",
@@ -58,6 +58,7 @@
5858
"rimraf": "^4.1.2",
5959
"serve": "^14.1.2",
6060
"tailwindcss": "^3.2.6",
61+
"tsx": "^3.12.3",
6162
"typescript": "^4.7.4",
6263
"vercel": "^28.10.1",
6364
"vite-plugin-pwa": "^0.14.1",

0 commit comments

Comments
 (0)