Skip to content

Commit 47485de

Browse files
committed
fix: import pusher on demand
1 parent d14e33b commit 47485de

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/runtime/plugin.client.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ import type { Channel, Options, ChannelAuthorizationCallback } from 'pusher-js'
33
import type { ChannelAuthorizationData } from 'pusher-js/types/src/core/auth/options'
44
import { createConsola, type ConsolaInstance } from 'consola'
55
import type { FetchOptions } from 'ofetch'
6-
import Pusher from 'pusher-js'
76
import { useEchoConfig } from './composables/useEchoConfig'
87
import type { Authentication, ModuleOptions } from './types'
98
import { defineNuxtPlugin, createError, useCookie } from '#app'
109

1110
declare global {
1211
interface Window {
1312
Echo: Echo
14-
Pusher: typeof Pusher
1513
}
1614
}
1715

@@ -137,6 +135,9 @@ export default defineNuxtPlugin(async (_nuxtApp) => {
137135
const config = useEchoConfig()
138136
const logger = createEchoLogger(config.logLevel)
139137

138+
const Pusher = (await import('pusher-js')).default
139+
140+
// @ts-expect-error window has no Pusher property
140141
window.Pusher = Pusher
141142
window.Echo = new Echo(prepareEchoOptions(config, logger))
142143

0 commit comments

Comments
 (0)