Skip to content

Commit 5bf0fe2

Browse files
committed
fix: disable icon integration on stackblitz
1 parent 16b003e commit 5bf0fe2

File tree

4 files changed

+17
-5
lines changed

4 files changed

+17
-5
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"@kevinmarrec/nuxt-pwa": "^0.3.0",
5656
"@nuxt/kit": "^3.0.0-rc.4",
5757
"pathe": "^0.3.0",
58+
"std-env": "^3.1.1",
5859
"unimport": "^0.2.9"
5960
},
6061
"devDependencies": {

playground/nuxt.config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ import { defineNuxtConfig } from 'nuxt'
33
export default defineNuxtConfig({
44
modules: ['nuxt-ionic'],
55
ionic: {
6-
integrations: {
6+
// integrations: {
77
// meta: true,
8-
pwa: false,
8+
// pwa: true,
99
// router: true,
10-
},
10+
// },
1111
// css: {
1212
// core: true,
1313
// basic: true,

pnpm-lock.yaml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/module.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
installModule,
99
} from '@nuxt/kit'
1010
import type { NuxtPage } from '@nuxt/schema'
11+
import { provider } from 'std-env'
1112

1213
export interface ModuleOptions {
1314
integrations?: {
@@ -93,7 +94,8 @@ export default defineNuxtModule<ModuleOptions>({
9394
)
9495
})
9596

96-
if (options.integrations.meta) {
97+
if (options.integrations?.meta) {
98+
nuxt.options.app.head.meta = nuxt.options.app.head.meta || []
9799
for (const meta of metaDefaults) {
98100
if (!nuxt.options.app.head.meta.some(i => i.name === meta.name)) {
99101
nuxt.options.app.head.meta.unshift(meta)
@@ -103,7 +105,14 @@ export default defineNuxtModule<ModuleOptions>({
103105
'viewport-fit: cover, width: device-width, initial-scale: 1.0, minimum-scale: 1.0, maximum-scale: 1.0, user-scalable: no'
104106
}
105107

106-
if (options.integrations.pwa) {
108+
if (options.integrations?.pwa) {
109+
if (provider === 'stackblitz') {
110+
;(nuxt.options.pwa as any) = (nuxt.options.pwa as any) || {}
111+
;(nuxt.options.pwa as any).icon = false
112+
console.warn(
113+
'Disabling PWA icon generation as `sharp` is not currently supported on StackBlitz.'
114+
)
115+
}
107116
await installModule('@kevinmarrec/nuxt-pwa')
108117
}
109118

0 commit comments

Comments
 (0)