Open philip-weber opened 2 years ago
Hello,
Indeed, we tried to make broadcast-channel
an optional dependency since it's only used in broadcastQueryClient
to reduce the package size.
It created a side effect with vite which tries to load it even if you do not use broadcastQueryClient
. Maybe we could open an issue on the vite
side to improve this behavior.
As a workaround, you can exclude broadcast-channel
from the dependency pre-bundling process.
Edit 1:
I created a minimal reproduction projects, it seems that added svelte-query
or broadcast-channel
is not enough to workaround this issue.
Edit 2: I filled an issue on the vite project (vitejs/vite#6007) to see if it's possible to better handle optional dynamically imported dependencies.
@SomaticIT @SomaticIT Are you able to use svelte-query
with SvelteKit right now? I have tried to build the app with svelte-query
installed, but still it has failed due to the broadcast-channel
package
I use it on a SvelteKit project in SPA mode.
I have to install broadcast-channel
to allow vite to analyze imports.
@SomaticIT i actually installed broadcast-channel
but am still getting this error. no idea how to resolve.
update: solved by deleting .svelte-kit
and installing svelte query again
After updating to release 1.5.0 I needed to install
broadcast-channel
manually to get my project running in development mode. The production bundle, on the other hand, can be created without the dependency without any problems and works perfectly. I'm not using thebroadcastQueryClient
in my project. I usevite@2.6.14
. Of course I can installbroadcast-channel
but I thought it would not be needed as of release 1.5.0. Or did I understand the release notes wrong? Do I have to make certain settings invite
for it to work? I have already excluded@sveltestack/svelte-query
in thevite.config.js
.