question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Still issues with broadcast-channel dependency and svelte-kit

See original GitHub issue

@amen-souissi @benmccann I tried 1.4.1 now.

We still have a problem with broadcast-channel if I remove these lines from svelte.config.js:

vite: {
  optimizeDeps: {
    include: ['broadcast-channel']
  },
}

This is the log:

1:22:06 AM [vite] Error when evaluating SSR module /node_modules/broadcast-channel/dist/es/method-chooser.js:
ReferenceError: require is not defined
    at eval (/node_modules/broadcast-channel/dist/es/method-chooser.js:26:20)
    at instantiateModule (C:\kit\node_modules\vite\dist\node\chunks\dep-e9a16784.js:68197:166)

Do you have any idea?

Maybe this is related to "type": "module" in package.json which is the default in a new SvelteKit project, right?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
darekazecommented, Jun 8, 2021

Hi, I don’t think this is a window-only bug, cuz I also got this error using Ubuntu Linux. Even I tested a basic repo running in codesandbox, I still got the same error.

Here is a reproduce repo made in Code Sandbox, hope this help: https://codesandbox.io/s/svelte-query-bug-141-f0ksh

Updates: For workaround, make sure broadcast-channel is presented in vite.optimizeDeps.include.

vite: {
  optimizeDeps: {
    include: ['broadcast-channel']
  },
}
2reactions
SomaticITcommented, Nov 11, 2021

Hello,

A new version (v1.5.0) of this library has been published today. This version makes broadcast-channel an optional dependency. This should fix all problems with svelte-kit.

If you need to use the experimental broadcastQueryClient, you now need to install it manually (see: broadcastQueryClient).

If you still encounter issues with v1.5.0. Please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting lots of 'Failed to execute 'postMessage' on ... - Reddit
Getting lots of 'Failed to execute 'postMessage' on 'BroadcastChannel': Channel is closed' errors. Everything seems to be working ok. However, ...
Read more >
broadcastQueryClient (Experimental) - Svelte Query
This utility comes packaged with svelte-query and is available under the @sveltestack/svelte-query import. However, this utility needs the broadcast-channel ...
Read more >
توییتر \ James Hibbard (@jchibbard) - Twitter
In this article, Juan Diego covers the least known yet extremely useful APIs, such as the Page Visibility API, Web Sharing API, Broadcast...
Read more >
Svelte I18n | internationalization Library for Svelte - Morioh
svelte-i18n helps you localize your app using the reactive tools Svelte provides. By using stores to keep track of the current locale, dictionary...
Read more >
comments - Hacker News
The general issue with computer-assisted surveillance is that it is ... On top of that, cheating is still possible with readily available tools,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found