JamesBrill / react-speech-recognition

💬Speech recognition for your React app
https://webspeechrecognition.com/
MIT License
645 stars 116 forks source link

Failed to resolve import "web-worker:./worker" from "node_modules\@speechly\browser-client\src\websocket\webWorkerController.ts". Does the file exist? #143

Open YoussefZidan opened 1 year ago

YoussefZidan commented 1 year ago

I completed the polyfill as instructed in the documentation in an attempt to use the app across browsers, but I still receive the following issue from node modules.

this happens with version 1.2.0

node_modules/@speechly/browser-client/src/websocket/webWorkerController.ts:2:0

1  |  import { WebsocketResponseType, WorkerSignal, ControllerSignal } from "./types";
2  |  import WebsocketClient from "web-worker:./worker";
   |                               ^
3  |  export class WebWorkerController {
4  |    constructor() {
YoussefZidan commented 1 year ago

I downgraded the version from 1.2.0 to 1.1.0 and the problem was solved!

JamesBrill commented 1 year ago

Hi @YoussefZidan Version 1.2.0 upgraded the Speechly Browser Client to a new major version, one that seems to introduce this TypeScript-based module import (the module is declared in a TypeScript declaration file here). Without the TypeScript compiler, this import wouldn't work. Your IDE might complain about it if TypeScript is not installed.

However, that library compiles its code to JavaScript and resolves the modules for you. So it shouldn't affect the development or compilation of your web app. To help me understand if this is a problem affecting other developers, can you confirm the following:

YoussefZidan commented 1 year ago

Hi @JamesBrill