Open juanjo opened 2 years ago
I am facing similar issues. I worked around this by importing specific imports like svelte-speech-recognition/SpeechRecognition
. After that when I run on dev
mode, my sveltekit
app starts throwing error
Watching for file changes...✘ [ERROR] Could not resolve "$app/env"
./node_modules/.pnpm/svelte-speech-recognition@0.0.5/node_modules/svelte-speech-recognition/SpeechRecognition.js:3:24:
3 │ import { browser } from '$app/env';
╵ ~~~~~~~~~~
Since this is supposed to be called only in the browser, I am importing this module inside my onMount
method like this
onMount(async () => {
const { useSpeechRecognition } = await import("svelte-speech-recognition/SpeechRecognition");
const { browserSupportsSpeechRecognition } = useSpeechRecognition({transcribing: true, clearTranscriptOnListen: null, commands: null});
console.log(`browserSupportsSpeechRecognition`, browserSupportsSpeechRecognition);
}
Hey guys, sorry for not getting back sooner. Thank you both for bringing this my attention. In the process of fixing both issues.
I'm looking into the SSR issues as well. In the example app in this repository it works fine outside of onMount. Trying to figure out why SSR breaks it while importing from the npm library.
I'll have more time to look at it this week and update/fix these issues.
having the same issue, I'm using sveltejs v3 bootstrapped to a codeigniter project
I have just followed the basic example and this is what I get:
Failed to resolve entry for package "svelte-speech-recognition". The package may have incorrect main/module/exports specified in its package.json: Missing "." export in "svelte-speech-recognition" package