dreamland
dreamland
NNuxt
Created by dreamland on 4/28/2024 in #❓・help
@vite-pwa/nuxt clients.matchAll not working in ServiceWorker with subdomain scope
I have a ServiceWorker that checks if a client is visible. It works fine on other platforms, but with an installed PWA on iOS the clients.matchAll method returns an empty list. It works fine when the scope is a second-level domain, but when the scope is a subdomain the clients.matchAll method returns an empty list. It works Has anybody experienced this? https://developer.mozilla.org/en-US/docs/Web/API/Clients/matchAll
4 replies
NNuxt
Created by dreamland on 3/7/2024 in #❓・help
`?raw` import works in vite (`nuxt dev`) but not in rollup (`nuxt generate`)
As described in the title ?raw works in vite but not in rollup. Simple steps to reproduce: npx nuxi@latest init raw add app.css
/* app.css */

.raw {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: black;
}
/* app.css */

.raw {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
background-color: black;
}
edit app.vue
<!-- app.vue -->

<script setup lang="ts">

import appcss from "~/app.css?raw"

useHead({
style: [appcss]
})

</script>

<template>
<div class="raw">
</div>
</template>
<!-- app.vue -->

<script setup lang="ts">

import appcss from "~/app.css?raw"

useHead({
style: [appcss]
})

</script>

<template>
<div class="raw">
</div>
</template>
npm run dev works. npm run generate results in following error.
Nuxt Build Error: Expression expected (Note that you need plugins to import files that are not JavaScript)
file: C:/some/path/raw/app.css?raw?inline&used:3:0
1: /* app.css */
2:
3: .raw {
^
4: width: 100%;
5: height: 100%;

at getRollupError (/C:/some/path/raw/node_modules/rollup/dist/es/shared/parseAst.js:375:41)
at ParseError.initialise (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:11155:28)
at convertNode (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:12895:10)
at convertProgram (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:12215:12)
at Module.setSource (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:14039:24)
at async ModuleLoader.addModuleSource (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:18689:13)
Nuxt Build Error: Expression expected (Note that you need plugins to import files that are not JavaScript)
file: C:/some/path/raw/app.css?raw?inline&used:3:0
1: /* app.css */
2:
3: .raw {
^
4: width: 100%;
5: height: 100%;

at getRollupError (/C:/some/path/raw/node_modules/rollup/dist/es/shared/parseAst.js:375:41)
at ParseError.initialise (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:11155:28)
at convertNode (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:12895:10)
at convertProgram (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:12215:12)
at Module.setSource (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:14039:24)
at async ModuleLoader.addModuleSource (/C:/some/path/raw/node_modules/rollup/dist/es/shared/node-entry.js:18689:13)
I'm currently trying to convince rollup to understand the ?raw import like vite does using the following, but I'm not sure how, or if that would even work..
// declarations.d.ts

declare module "*?raw" {
const src: string
export default src
}
// declarations.d.ts

declare module "*?raw" {
const src: string
export default src
}
8 replies
NNuxt
Created by dreamland on 3/6/2024 in #❓・help
SPA w/ SEO or SSG + nitro?
i'm creating a SPA and i've opted to use nuxt because of the ease of development (especially for the frontend devs in my team, that automatically get an up to date server when they pull) my expectation was that the data from useSeoMeta from app.vue would be included in the build even with ssr: false, but apparently all seo meta data is disregarded in that case (https://stackoverflow.com/questions/74070241/what-is-the-difference-between-ssrfalse-vs-targetstatic-in-nuxtjs) so i've tried to use SSG and running nitro separately, but i keep running into problems.. i've been reading about it the entire afternoon and evening. it seems like such a basic usecase, but i can't find anything about it. i feel like i'm missing something obvious. any pointers appreciated
40 replies