I'm having a trouble with the migration from the MV2 to MV3 in my chrome extension application. With the MV2, everything worked fine implementing the azure library in the background.js file through the html one. But with the MV3 and the background.js file becoming a service worker i tried several thing to make my app functional with no results.
According to the documentation, i switched background part in the manifest file to :
"background": {
"service_worker": "background.js",
"type": "module"
},
I built the module of the azure cognitive services sdk through https://github.com/microsoft/cognitive-services-speech-sdk-js
But when i try to import it in the background.js like this :
import * as SpeechSDK from './distrib/es2015/microsoft.cognitiveservices.speech.sdk.js';
var speechConfig = SpeechSDK.SpeechConfig.fromSubscription(
"key",
"region"
);
speechConfig.speechRecognitionLanguage = "fr-FR";
speechConfig.outputFormat = SpeechSDK.OutputFormat.Detailed;
I get the error "Service worker registration failed" and "An unknown error occurred when fetching the script." I tried multiples things like using a wrapper or the importScripts function according to this post : chrome extension mv3 - Modularize service worker js file but none of them worked for me. Do you have any idea how to use the azure cognitive services in a chrome extension MV3 ? Thanks in advance !