Fix some build warnings
This commit is contained in:
parent
2d20985c62
commit
f83019a401
3 changed files with 27 additions and 18 deletions
|
|
@ -4,15 +4,15 @@
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
DisconnectReason,
|
DisconnectReason,
|
||||||
LocalParticipant,
|
|
||||||
LocalTrackPublication,
|
|
||||||
Participant,
|
|
||||||
Room as LiveKitRoom,
|
Room as LiveKitRoom,
|
||||||
RoomEvent,
|
RoomEvent,
|
||||||
Track,
|
Track,
|
||||||
TrackPublication,
|
|
||||||
supportsAudioOutputSelection,
|
supportsAudioOutputSelection,
|
||||||
type AudioCaptureOptions,
|
type AudioCaptureOptions,
|
||||||
|
type LocalParticipant,
|
||||||
|
type LocalTrackPublication,
|
||||||
|
type Participant,
|
||||||
|
type TrackPublication,
|
||||||
} from "livekit-client"
|
} from "livekit-client"
|
||||||
import {App} from "@capacitor/app"
|
import {App} from "@capacitor/app"
|
||||||
import {derived, get, writable} from "svelte/store"
|
import {derived, get, writable} from "svelte/store"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import QRCode from "qrcode"
|
|
||||||
import Button from "@lib/components/Button.svelte"
|
import Button from "@lib/components/Button.svelte"
|
||||||
import {clip} from "@app/toast"
|
import {clip} from "@app/toast"
|
||||||
|
|
||||||
|
|
@ -12,22 +11,20 @@
|
||||||
|
|
||||||
const copy = () => clip(code)
|
const copy = () => clip(code)
|
||||||
|
|
||||||
$effect(() => {
|
// qrcode is imported here rather than at the top of the module because svelte strips effect
|
||||||
if (canvas && wrapper && code) {
|
// bodies when compiling for SSR, which would leave the import with no remaining use.
|
||||||
QRCode.toCanvas(canvas, code)
|
const draw = async (canvas: HTMLCanvasElement, wrapper: Element, code: string) => {
|
||||||
}
|
const QRCode = await import("qrcode")
|
||||||
})
|
|
||||||
|
await QRCode.toCanvas(canvas, code)
|
||||||
|
|
||||||
|
scale = wrapper.getBoundingClientRect().width / canvas.width
|
||||||
|
height = canvas.height * scale
|
||||||
|
}
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
// Draw first so canvas.width/height reflect the current code, then fit the
|
|
||||||
// intrinsic canvas size to the wrapper. Measure the intrinsic size (not
|
|
||||||
// getBoundingClientRect, which includes the transform below) so this stays
|
|
||||||
// idempotent — otherwise scale feeds back into its own measurement and loops.
|
|
||||||
if (canvas && wrapper && code) {
|
if (canvas && wrapper && code) {
|
||||||
const wrapperRect = wrapper.getBoundingClientRect()
|
draw(canvas, wrapper, code)
|
||||||
|
|
||||||
scale = wrapperRect.width / canvas.width
|
|
||||||
height = canvas.height * scale
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,20 @@ export default defineConfig({
|
||||||
SvelteKitPWA({
|
SvelteKitPWA({
|
||||||
registerType: "autoUpdate",
|
registerType: "autoUpdate",
|
||||||
injectRegister: "auto",
|
injectRegister: "auto",
|
||||||
|
// adapter-static writes the fallback shell after the service worker is generated, so the
|
||||||
|
// plugin can't glob it — this precaches "/" explicitly, giving workbox's navigation
|
||||||
|
// fallback something to bind to.
|
||||||
|
kit: {
|
||||||
|
spa: true,
|
||||||
|
adapterFallback: "/",
|
||||||
|
},
|
||||||
workbox: {
|
workbox: {
|
||||||
maximumFileSizeToCacheInBytes: 5 * 1024 ** 2, // 5 MB or set to something else
|
maximumFileSizeToCacheInBytes: 5 * 1024 ** 2, // 5 MB or set to something else
|
||||||
|
// The service worker is generated before SvelteKit prerenders anything, so the
|
||||||
|
// "prerendered/**" glob @vite-pwa/sveltekit forces in never matches. It only forces it
|
||||||
|
// when modifyURLPrefix is unset, and an empty one is a no-op.
|
||||||
|
modifyURLPrefix: {},
|
||||||
|
globPatterns: ["client/**/*.{js,css,ico,png,svg,webp,webmanifest}"],
|
||||||
},
|
},
|
||||||
manifest: {
|
manifest: {
|
||||||
name: process.env.VITE_PLATFORM_NAME,
|
name: process.env.VITE_PLATFORM_NAME,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue