diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b06fae468..de59e79c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Although it no locker lock up microphone, clicking on the microphone button has no effect because Direct Line Speech does not support aborting speech recognition - Fixes [#3421](https://github.com/microsoft/BotFramework-WebChat/issues/3421). With Direct Line Speech, after not able to recognize any speech, it should no longer stop working, by [@compulim](https://github.com/compulim) in PR [#3694](https://github.com/microsoft/BotFramework-WebChat/pull/3694) - Fixes [#3616](https://github.com/microsoft/BotFramework-WebChat/issues/3616). [Accessibility documentation] Update activity timestamp grouping to match visual UI, by [@amal-khalaf](https://github.com/amal-khalaf) in PR [#3708](https://github.com/microsoft/BotFramework-WebChat/pull/3708) +- Fixes [#3718](https://github.com/microsoft/BotFramework-WebChat/issues/3718). Fixed `webpack.config.js` to use default settings of `['browser', 'module', 'main']` and resolved issues with `uuid` package in IE11, by [@compulim](https://github.com/compulim) in PR [#3726](https://github.com/microsoft/BotFramework-WebChat/pull/3726) ### Changed diff --git a/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.js b/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.js index 8ac1094a21..6e797f8fb4 100644 --- a/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.js +++ b/packages/bundle/src/createCognitiveServicesSpeechServicesPonyfillFactory.js @@ -1,5 +1,4 @@ import { AudioConfig } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig'; -import { MicAudioSource } from 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/MicAudioSource'; import createPonyfill from 'web-speech-cognitive-services/lib/SpeechServices'; function resolveFunction(fnOrValue) { @@ -61,42 +60,6 @@ export default function createCognitiveServicesSpeechServicesPonyfillFactory({ audioConfig = audioInputDeviceId ? AudioConfig.fromMicrophoneInput(audioInputDeviceId) : AudioConfig.fromDefaultMicrophoneInput(); - - const source = audioConfig.privSource; - - // WORKAROUND: In Speech SDK 1.12.0-1.13.1, it dropped support of macOS/iOS Safari. - // This code is adopted from microsoft-cognitiveservices-speech-sdk/src/common.browser/MicAudioSource.ts. - // We will not need this code when using Speech SDK 1.14.0 or up. - // TODO: [P1] #3575 Remove the following lines when bumping to Speech SDK 1.14.0 or higher - source.createAudioContext = () => { - // eslint-disable-next-line no-extra-boolean-cast - if (!!source.privContext) { - return; - } - - const AudioContext = window.AudioContext || window.webkitAudioContext; - - if (typeof AudioContext === 'undefined') { - throw new Error('Browser does not support Web Audio API (AudioContext/webkitAudioContext is not available).'); - } - - if (navigator.mediaDevices.getSupportedConstraints().sampleRate) { - source.privContext = new AudioContext({ sampleRate: MicAudioSource.AUDIOFORMAT.samplesPerSec }); - } else { - source.privContext = new AudioContext(); - } - }; - - // This piece of code is adopted from microsoft-cognitiveservices-speech-sdk/common.browser/MicAudioSource.ts. - // Instead of closing the AudioContext, it will just suspend it. And the next time it is needed, it will be resumed (by the original code). - source.destroyAudioContext = () => { - if (!source.privContext) { - return; - } - - source.privRecorder.releaseMediaResources(source.privContext); - source.privContext.state === 'running' && source.privContext.suspend(); - }; } return ({ referenceGrammarID } = {}) => { diff --git a/packages/bundle/webpack.config.js b/packages/bundle/webpack.config.js index 268e0d5c7e..bc861e130f 100644 --- a/packages/bundle/webpack.config.js +++ b/packages/bundle/webpack.config.js @@ -1,3 +1,7 @@ +/* eslint @typescript-eslint/no-var-requires: "off" */ +/* eslint no-magic-numbers: ["error", { "ignore": [2] }] */ +/* global __dirname, module, process */ + const { join } = require('path'); const { resolve } = require('path'); const { StatsWriterPlugin } = require('webpack-stats-plugin'); @@ -42,11 +46,6 @@ let config = { __dirname, 'node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/Audio/AudioConfig.js' ), - // TODO: [P1] #3575 Remove the following line when bumping to Speech SDK 1.14.0 or higher - 'microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/MicAudioSource': resolve( - __dirname, - 'node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.browser/MicAudioSource.js' - ), 'microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk': resolve( __dirname, 'node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/microsoft.cognitiveservices.speech.sdk.js' @@ -57,18 +56,7 @@ let config = { ), react: resolve(__dirname, 'node_modules/isomorphic-react/dist/react.js'), 'react-dom': resolve(__dirname, 'node_modules/isomorphic-react-dom/dist/react-dom.js') - }, - - // Since Webpack is configured not to transpile, we cannot use package.json/module field to load a module. - // The default Webpack module resolution order is: "module", then "browser", then "main". - // - // De facto entrypoint definitions: - // - "module": ES.next: transpilation is required for this entrypoint. It should yield code with smallest footprint. - // - "main": Plain old Node.js or browser: should be ES5 compatible. It may be configured to work only on either Node.js or browser. - // - "browser": Plain old browsers (ES5, which is supported by IE9). This entrypoint will not work on Node.js. - // - // If both "main" and "browser" are present, "main" will be for Node.js and "browser" will be for browsers. - mainFields: ['browser', 'main'] + } } }; @@ -97,7 +85,7 @@ if (node_env !== 'production' && node_env !== 'test') { join(__dirname, '../core/lib'), join(__dirname, '../directlinespeech/lib') ], - test: /\.js$/, + test: /\.js$/iu, use: ['source-map-loader'] } ]