Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove mainFields in webpack.config.js #3726

Merged
merged 3 commits into from
Feb 17, 2021
Merged

Conversation

compulim
Copy link
Contributor

@compulim compulim commented Feb 16, 2021

Fixes #3718.

Changelog Entry

  • Fixes #3718. Fixed webpack.config.js to use default settings of ['browser', 'module', 'main'] and resolved issues with uuid package in IE11, by @compulim in PR #3726

Description

Note: this change will only modify our bundle build (a.k.a. webchat*.js). It won't impact our NPM build.

I have tested the build on IE11 with both DLJS and DLSpeech. And particularly in DLJS, tested most features, including Adaptive Cards and Markdown.

  • Long time ago, in webpack.config.js, we added mainFields: ['browser', 'main']
    • The default is ['browser', 'module', 'main'], we removed module
    • This is because Speech SDK is exposing entry points in a wrong way:
      • module should be ES5 import/export, but they exposed it as ES.next import/export
    • So, we have to disable module to prevent ES.next leaked into our bundle
  • More recently, in webpack.config.js, we used resolve.alias to import Speech SDK, instead of relying on Speech SDK's package.json
    • Because we no longer relies on package.json, mainFields options was not needed for Speech SDK
    • Since the original mainFields was introduced for Speech SDK and we moved to resolve.alias, the mainFields seems obsoleted
  • Fast forward to today, the issue in uuid is only exposed when someone set mainFields to prefer main over module

As this change only affect our bundle build and not NPM build, web developers who use our NPM build should expect unchanged behavior.

This means, as Speech SDK was not correct on the usage of module field (using ES.next code). Web developer who use Web Chat NPM build should configure their build pipeline to either:

  1. Use main field for microsoft-cognitiveservices-speech-sdk, or
  2. Transpile code for microsoft-cognitiveservices-speech-sdk

Specific Changes

  • Update webpack.config.js and remove mainFields
  • Remove unneeded code in webpack.config.js and createCognitiveServicesSpeechServicesPonyfillFactory.js
    • The code is for previous version of Speech SDK and the issue has been resolved in 1.15.1
  • I have added tests and executed them locally
  • Existing tests will cover these cases
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

@compulim compulim merged commit e274fa9 into microsoft:master Feb 17, 2021
@compulim compulim deleted the fix-3718 branch February 17, 2021 07:43
@compulim compulim mentioned this pull request Mar 2, 2021
52 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uuid package introduced from Speech SDK broke IE11
2 participants