Skip to content

Commit 96a5060

Browse files
fix: options
1 parent 7f49095 commit 96a5060

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/module.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ const nuxtModule: Module<ModuleOptions> = function (moduleOptions) {
2929
const optionsPath: string = this.nuxt.resolver.resolveAlias(options.optionsPath ||
3030
join(this.options.dir!.app || 'app', 'laravel-echo', 'options.js'))
3131

32+
delete options.optionsPath
33+
3234
// Register options template
3335
this.addTemplate({
3436
fileName: `laravel-echo/options.${optionsPath && optionsPath.endsWith('ts') ? 'ts' : 'js'}`,
@@ -40,10 +42,7 @@ const nuxtModule: Module<ModuleOptions> = function (moduleOptions) {
4042
const { dst } = this.addTemplate({
4143
src: resolve(__dirname, './runtime/plugin.js'),
4244
fileName: 'laravel-echo/plugin.js',
43-
options: {
44-
broadcaster: options.broadcaster,
45-
encrypted: options.encrypted
46-
}
45+
options
4746
})
4847

4948
plugins.push({

src/runtime/plugin.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import defu from 'defu'
12
import options from './options'
23
import { Echo } from '~echo'
34

@@ -19,7 +20,7 @@ export default async function (ctx, inject) {
1920
if (!window.io) window.io = require('socket.io-client')
2021
<% } %>
2122

22-
const echo = new Echo(ctx, echoOptions)
23+
const echo = new Echo(ctx, defu(echoOptions, <%= serializeFunction(options) %>))
2324
await echo.init()
2425

2526
inject('echo', echo)

0 commit comments

Comments
 (0)